Re: [HACKERS] remove contrib/xml2
Hi Alvaro, I followed your instruction but put the patch on 8.4.2 as I found it crashes. It looks like the server still crash in the same way. Can you and anyone give me some ideas how to fix this bug? == conifer=# CREATE TABLE xpath_test (id integer NOT NULL, t xml); CREATE TABLE conifer=# INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); INSERT 0 1 conifer=# SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. ! == Best, M Z CREATE TABLE xpath_test (id integer NOT NULL, t xml); INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); Hmm. Well, all I know is that the first thing I tried crashed the server. This trivial patch lingering on my system fixes this crasher (this is for the 8.3 branch). It makes the problem in alloc set ExprContext warning show up instead. There are still lotsa other holes, but hey, this is a start ... Index: contrib/xml2/xpath.c === RCS file: /home/alvherre/Code/cvs/pgsql/contrib/xml2/xpath.c,v retrieving revision 1.16.2.1 diff -c -p -r1.16.2.1 xpath.c *** contrib/xml2/xpath.c26 Mar 2008 01:19:11 - 1.16.2.1 --- contrib/xml2/xpath.c27 Jan 2010 15:30:56 - *** xpath_table(PG_FUNCTION_ARGS) *** 793,798 --- 793,801 */ pgxml_parser_init(); + PG_TRY(); + { + /* For each row i.e. document returned from SPI */ for (i = 0; i proc; i++) { *** xpath_table(PG_FUNCTION_ARGS) *** 929,934 --- 932,944 if (xmldoc) pfree(xmldoc); } + } + PG_CATCH(); + { + xmlCleanupParser(); + PG_RE_THROW(); + } + PG_END_TRY(); xmlCleanupParser(); /* Needed to flag completeness in 7.3.1. 7.4 defines it as a no-op. */ -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] Error when building postgresql with contrib functions
Hi I am trying to build postgresql with contrib functions from source code checked out from cvs version 8.3.8 but getting error: == conifer=# SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); ERROR: function xpath_table(unknown, unknown, unknown, unknown, unknown) does not exist LINE 1: SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. == Looks like the contrib functions have not been added in. OS Ubuntu Karmic. I checked out source code from branch 8.3.8. Before building postgresql, $ sudo apt-get install libreadline6-dev zlib1g-dev libxml2-dev libxslt1-dev bison flex libreadline6-dev needs libncurses5-dev as dependency so libncurses5-dev was also installed. The installation step I performed: $ ./configure --with-libxml --with-libxslt $ make $ make check $ sudo make install $ export PGDATA=/data/pgsql/data $ initdb $ createdb conifer $ pg_ctl start $ psql everything looks fine but I got error by doing: conifer=# CREATE TABLE xpath_test (id integer NOT NULL, t xml); CREATE TABLE conifer=# INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); INSERT 0 1 conifer=# SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); ERROR: function xpath_table(unknown, unknown, unknown, unknown, unknown) does not exist LINE 1: SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. Thank you very much for your help. Best, M Z
Re: [HACKERS] CVS checkout source code for different branches
Hi Andrew and all, I am still struggling with the branch repositories. I tried to checkout from branch repositories but got error no such repositories: $ cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/REL8_4_STABLE co -P pgsql /projects/REL8_4_STABLE: no such repository $ cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/REL8_3_STABLE co -P pgsql /projects/REL8_3_STABLE: no such repository $ cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/REL8_4_STABLE co -P pgsql /REL8_4_STABLE: no such repository $ cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/REL8_3_STABLE co -P pgsql /REL8_3_STABLE: no such repository What are the correct repositories for these branch? Is there a way I can list these branch repositories and how? Many thanks, M Z On Mon, Feb 8, 2010 at 11:56 PM, Andrew Dunstan and...@dunslane.net wrote: The only sane things to check out apart from HEAD are normally the STABLE branches. For release m.n those are always called RELm_n_STABLE. You can also get the tag set for a specific release. Those are called RELm_n_o for m.n.o releases. If you look at the output for cvs log configure.in you can see near the top a list of tag sets under the heading symbolic names. HTH. M Z wrote: For example, how can I list all the branches for postgresql 8.3 (and 8.4)? Now I can checkout code using: cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/cvsroot co -P pgsql But I don't know when version it is, and I want get code from some postgresql 8.3 and 8.4 branches but I don't know the their cvsroot Thanks M Z On Mon, Feb 8, 2010 at 11:04 PM, M Z jm80...@gmail.com mailto: jm80...@gmail.com wrote: Hi Andrew, Could you please give a little more detail how I can find different CVS branches? Thanks, M Z On Mon, Feb 8, 2010 at 10:38 PM, Andrew Dunstan and...@dunslane.net mailto:and...@dunslane.net wrote: M Z wrote: Hi, I am trying to checkout code from different branches (such as 8.3, 8.4). I found a few ways to checkout code from CVS: 1. webCVS: http://anoncvs.postgresql.org/cvsweb.cgi/ 2. cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org: /projects/cvsroot co -P pgsql 3. $ rsync --progress -avzCH --delete anoncvs.postgresql.org::pgsql-cvs $CVSROOT However, how can I checkout code from different branches (such as 8.3, 8.4)? CVS is documented here, among other places: http://ximbiot.com/cvs/manual/cvs-1.11.20/cvs.html To check out a particular branch such as REL8_4_STABLE, use the -r option on the checkout command: cvs checkout -r branchname cheers andrew
Re: [HACKERS] CVS checkout source code for different branches
Final, I tried: $ cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/cvsroot co -r REL8_3_STABLE -P pgsql Checked file configure.in. Around line 20, there is line: AC_INIT([PostgreSQL], [8.3.9], [pgsql-b...@postgresql.org]) Not sure that indicates version 8.3.9? But still, is there a testing/developing version for 8.3? I remember Alvaro made a patch to contrib/xml2/xpath.c. What is that version? and How can get this version? Is there a way I can list all branches / versions in CVS server? *** Index: contrib/xml2/xpath.c == = RCS file: /home/alvherre/Code/cvs/pgsql/contrib/xml2/xpath.c,v retrieving revision 1.16.2.1 diff -c -p -r1.16.2.1 xpath.c *** contrib/xml2/xpath.c26 Mar 2008 01:19:11 - 1.16.2.1 --- contrib/xml2/xpath.c27 Jan 2010 15:30:56 - *** xpath_table(PG_FUNCTION_ARGS) *** 793,798 --- 793,801 */ pgxml_parser_init(); + PG_TRY(); + { + /* For each row i.e. document returned from SPI */ for (i = 0; i proc; i++) { *** xpath_table(PG_FUNCTION_ARGS) *** 929,934 --- 932,944 if (xmldoc) pfree(xmldoc); } + } + PG_CATCH(); + { + xmlCleanupParser(); + PG_RE_THROW(); + } + PG_END_TRY(); xmlCleanupParser(); /* Needed to flag completeness in 7.3.1. 7.4 defines it as a no-op. */ ***
Re: [HACKERS] CVS checkout source code for different branches
Thanks Robert, Your reply helps a lot. Just right after sending post, I found the way to list all branches in the CVS server. Best, M Z On Tue, Feb 9, 2010 at 10:43 PM, Robert Haas robertmh...@gmail.com wrote: On Tue, Feb 9, 2010 at 10:35 PM, M Z jm80...@gmail.com wrote: Final, I tried: $ cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/cvsroot co -r REL8_3_STABLE -P pgsql Checked file configure.in. Around line 20, there is line: AC_INIT([PostgreSQL], [8.3.9], [pgsql-b...@postgresql.org]) Not sure that indicates version 8.3.9? But still, is there a testing/developing version for 8.3? REL8_3_STABLE is the head of the stable branch for 8.3. It says 8.3.9 right now because 8.3.9 is the last release that was stamped off that branch, but what you checked out actually has any changes backpatched since then on it as well. I remember Alvaro made a patch to contrib/xml2/xpath.c. What is that version? and How can get this version? That patch hasn't been applied yet. You have to download it from his message and apply it to your local copy using the patch program. Is there a way I can list all branches / versions in CVS server? Andrew already answered that question in his previous message: use cvs log on a file that's been around for a long time, like configure.in. It sounds like you need to find some documentation for CVS and read it, and/or find a CVS help mailing list and post to it. ...Robert
[HACKERS] CVS checkout source code for different branches
Hi, I am trying to checkout code from different branches (such as 8.3, 8.4). I found a few ways to checkout code from CVS: 1. webCVS: http://anoncvs.postgresql.org/cvsweb.cgi/ 2. cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/cvsroot co -P pgsql 3. $ rsync --progress -avzCH --delete anoncvs.postgresql.org::pgsql-cvs $CVSROOT However, how can I checkout code from different branches (such as 8.3, 8.4)? Thank you. M Z
Re: [HACKERS] CVS checkout source code for different branches
Hi Andrew, Could you please give a little more detail how I can find different CVS branches? Thanks, M Z On Mon, Feb 8, 2010 at 10:38 PM, Andrew Dunstan and...@dunslane.net wrote: M Z wrote: Hi, I am trying to checkout code from different branches (such as 8.3, 8.4). I found a few ways to checkout code from CVS: 1. webCVS: http://anoncvs.postgresql.org/cvsweb.cgi/ 2. cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/cvsroot co -P pgsql 3. $ rsync --progress -avzCH --delete anoncvs.postgresql.org::pgsql-cvs $CVSROOT However, how can I checkout code from different branches (such as 8.3, 8.4)? CVS is documented here, among other places: http://ximbiot.com/cvs/manual/cvs-1.11.20/cvs.html To check out a particular branch such as REL8_4_STABLE, use the -r option on the checkout command: cvs checkout -r branchname cheers andrew
Re: [HACKERS] CVS checkout source code for different branches
For example, how can I list all the branches for postgresql 8.3 (and 8.4)? Now I can checkout code using: cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/cvsroot co -P pgsql But I don't know when version it is, and I want get code from some postgresql 8.3 and 8.4 branches but I don't know the their cvsroot Thanks M Z On Mon, Feb 8, 2010 at 11:04 PM, M Z jm80...@gmail.com wrote: Hi Andrew, Could you please give a little more detail how I can find different CVS branches? Thanks, M Z On Mon, Feb 8, 2010 at 10:38 PM, Andrew Dunstan and...@dunslane.netwrote: M Z wrote: Hi, I am trying to checkout code from different branches (such as 8.3, 8.4). I found a few ways to checkout code from CVS: 1. webCVS: http://anoncvs.postgresql.org/cvsweb.cgi/ 2. cvs -z3 -d :pserver:anoncvs:passw...@anoncvs.postgresql.org:/projects/cvsroot co -P pgsql 3. $ rsync --progress -avzCH --delete anoncvs.postgresql.org::pgsql-cvs $CVSROOT However, how can I checkout code from different branches (such as 8.3, 8.4)? CVS is documented here, among other places: http://ximbiot.com/cvs/manual/cvs-1.11.20/cvs.html To check out a particular branch such as REL8_4_STABLE, use the -r option on the checkout command: cvs checkout -r branchname cheers andrew
Re: [HACKERS] remove contrib/xml2
The thing is, why it doesn't crash on 8.3.8 but crash on 8.4.2? Any idea? A patch was applied to 8.3 but not to 8.4.2? Thanks, M Z On Fri, Feb 5, 2010 at 1:45 PM, Robert Haas robertmh...@gmail.com wrote: On Wed, Feb 3, 2010 at 8:49 AM, Alvaro Herrera alvhe...@commandprompt.com wrote: Robert Haas escribió: On Mon, Feb 1, 2010 at 5:23 PM, Andrew Dunstan and...@dunslane.net wrote: Robert Haas wrote: (2) add a very, very large warning that this will crash if you do almost anything with it. I think that's an exaggeration. Certain people are known to be using it quite successfully. Hmm. Well, all I know is that the first thing I tried crashed the server. CREATE TABLE xpath_test (id integer NOT NULL, t xml); INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); This trivial patch lingering on my system fixes this crasher (this is for the 8.3 branch). It makes the problem in alloc set ExprContext warning show up instead. There are still lotsa other holes, but hey, this is a start ... Interestingly M Z found he couldn't reproduce this crash on 8.3. Can you? If so, +1 for applying this and backpatching it as far as make sense. ...Robert -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] remove contrib/xml2
I did some tests followed Robert's test cases on both postgresql 8.4.2-0ubu and 8.3.8-1, OS: Ubuntu Karmic. 1) 1st test case, it doesn't crash on 8.3.8 but crash on 8.4.2; 2) 2nd test case, both 8.3.8 and 8.4.2 are fine, and no warning (different from Robert's test?); 3) 3rd test case (and modified test case for 8.3.8), both 8.3.8 and 8.4.2 are not correct, same with Robert's test (8.5 beta?); * 1st test case: == 8.3.8 == conifer=# CREATE TABLE xpath_test (id integer NOT NULL, t xml); CREATE TABLE conifer=# INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); INSERT 0 1 conifer=# SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); id 1 (1 row) == 8.4.2 == conifer=# CREATE TABLE xpath_test (id integer NOT NULL, t xml); CREATE TABLE conifer=# INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); INSERT 0 1 conifer=# SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. ! * * 2nd test case == 8.3.8 and 8.4.2 == conifer=# CREATE TABLE xpath_test (id integer NOT NULL, t text); CREATE TABLE conifer=# INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); INSERT 0 1 conifer=# SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); id 1 (1 row) * * 3rd test case == 8.3.8 and 8.4.2 == conifer=# CREATE TABLE xpath_test (id integer NOT NULL, t text); CREATE TABLE conifer=# INSERT INTO xpath_test VALUES (1, 'rowlistrow a=1/row a=2 b=oops//rowlist'); INSERT 0 1 conifer=# SELECT * FROM xpath_table('id', 't', 'xpath_test', '/rowlist/row/@a|/rowlist/row/@b', 'true') as t(id int4, a text, b text); id | a | b +---+-- 1 | 1 | oops 1 | 2 | (2 rows) == 8.3.8 (modified 3rd test case, because 8.3.8 won't crash using xml) == conifer=# CREATE TABLE xpath_test (id integer NOT NULL, t xml); CREATE TABLE conifer=# INSERT INTO xpath_test VALUES (1, 'rowlistrow a=1/row a=2 b=oops//rowlist'); INSERT 0 1 conifer=# SELECT * FROM xpath_table('id', 't', 'xpath_test', '/rowlist/row/@a|/rowlist/row/@b', 'true') as t(id int4, a text, b text); id | a | b +---+-- 1 | 1 | oops 1 | 2 | (2 rows) * For 1st test case, not sure if some paths applied to 8.3 haven't been applied to 8.4, or other reasons cause the difference between 8.3.8 and 8.4.2. Any ideas or comments? Thank you, M Z On Mon, Feb 1, 2010 at 8:44 PM, Robert Haas robertmh...@gmail.com wrote: On Mon, Feb 1, 2010 at 5:23 PM, Andrew Dunstan and...@dunslane.net wrote: Robert Haas wrote: (2) add a very, very large warning that this will crash if you do almost anything with it. I think that's an exaggeration. Certain people are known to be using it quite successfully. Hmm. Well, all I know is that the first thing I tried crashed the server. CREATE TABLE xpath_test (id integer NOT NULL, t xml); INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); It doesn't crash if you change the type of t from xml to text; instead you get a warning about some sort of memory allocation problem. DROP TABLE xpath_test; CREATE TABLE xpath_test (id integer NOT NULL, t text); INSERT INTO xpath_test VALUES (1, 'docint1/int/doc'); SELECT * FROM xpath_table('id', 't', 'xpath_test', '/doc/int', 'true') as t(id int4); yields: WARNING: problem in alloc set ExprContext: bogus aset link in block 0x14645e0, chunk 0x14648b8 And then there's this (see also bug #5285): DELETE FROM xpath_test; INSERT INTO xpath_test VALUES (1, 'rowlistrow a=1/row a=2 b=oops//rowlist'); SELECT * FROM xpath_table('id', 't', 'xpath_test', '/rowlist/row/@a|/rowlist/row/@b', 'true') as t(id int4, a text, b text); which yields an answer that is, at least, extremely surprising, if not flat-out wrong: id | a | b +---+-- 1 | 1 | oops 1 | 2 | (2 rows) Bugs #4953 and #5079 can also be reproduced in CVS HEAD. Both crash the server. ...Robert -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] contrib\xml2 package's xpath_table function in PostgreSQL
Is there a way to fix it so that those functions are usable in 8.4 without crashing the server? Thanks, M Z On Mon, Feb 1, 2010 at 10:50 AM, Robert Haas robertmh...@gmail.com wrote: The functions haven't actually been removed in 8.4, in spite of the deprecation notice. But it's very easy to use them in a way that crashes the entire server, so you're playing with fire. :-( ...Robert -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] contrib\xml2 package's xpath_table function in PostgreSQL
I am very interested in doing it. However I am new to postgresql. Could you and anyone here please give me some hint, which way I should, which part of code I should focus to fix it? Thanks, M Z On Mon, Feb 1, 2010 at 1:23 PM, Robert Haas robertmh...@gmail.com wrote: On Mon, Feb 1, 2010 at 1:20 PM, M Z jm80...@gmail.com wrote: Is there a way to fix it so that those functions are usable in 8.4 without crashing the server? Nobody seems to be interested enough to figure that out and submit a patch to fix it. If someone does, I think it would have a good chance of being accepted. ...Robert