Re: [BUGS] BUG #5534: IS DOCUMENT predicate errors instead of returning false
Quoting Mike Fowler : The following bug has been logged online: Bug reference: 5534 Logged by: Mike Fowler Email address: m...@mlfowler.com PostgreSQL version: 9.0beta2 Operating system: Linux 2.6.31-14-generic #48-Ubuntu SMP Description:IS DOCUMENT predicate errors instead of returning false Details: IS DOCUMENT should return false for a non-well formed document, and indeed is coded to do such. However, the conversion to the xml type which happens before the underlying xml_is_document function is even called fails and exceptions out. I've mentioned this on -hackers with message ID 20100701172553.w5vdy1xbocos8...@www.mlfowler.com -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs The attached patch is a very small patch that changes parse_expr.c to not convert everything to xml. This now means that when passed malformed XML it will return false instead of throwing an exception. In my mind this acceptable as I don't see anywhere in the standard that mandates that: xmlval IS NOT DOCUMENT == xmlval IS CONTENT Regards, -- Mike Fowler Registered Linux user: 379787 *** a/src/backend/parser/parse_expr.c --- b/src/backend/parser/parse_expr.c *** *** 1950,1956 transformXmlExpr(ParseState *pstate, XmlExpr *x) Assert(false); break; case IS_DOCUMENT: ! newe = coerce_to_specific_type(pstate, newe, XMLOID, "IS DOCUMENT"); break; } --- 1950,1956 Assert(false); break; case IS_DOCUMENT: ! newe = coerce_to_specific_type(pstate, newe, TEXTOID, "IS DOCUMENT"); break; } *** a/src/backend/utils/adt/xml.c --- b/src/backend/utils/adt/xml.c *** *** 795,801 xmlvalidate(PG_FUNCTION_ARGS) bool ! xml_is_document(xmltype *arg) { #ifdef USE_LIBXML bool result; --- 795,801 bool ! xml_is_document(text *arg) { #ifdef USE_LIBXML bool result; *** *** 805,811 xml_is_document(xmltype *arg) /* We want to catch ereport(INVALID_XML_DOCUMENT) and return false */ PG_TRY(); { ! doc = xml_parse((text *) arg, XMLOPTION_DOCUMENT, true, GetDatabaseEncoding()); result = true; } --- 805,811 /* We want to catch ereport(INVALID_XML_DOCUMENT) and return false */ PG_TRY(); { ! doc = xml_parse(arg, XMLOPTION_DOCUMENT, true, GetDatabaseEncoding()); result = true; } *** a/src/include/utils/xml.h --- b/src/include/utils/xml.h *** *** 70,76 extern xmltype *xmlelement(XmlExprState *xmlExpr, ExprContext *econtext); extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace); extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null); extern xmltype *xmlroot(xmltype *data, text *version, int standalone); ! extern bool xml_is_document(xmltype *arg); extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg); extern char *escape_xml(const char *str); --- 70,76 extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace); extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null); extern xmltype *xmlroot(xmltype *data, text *version, int standalone); ! extern bool xml_is_document(text *arg); extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg); extern char *escape_xml(const char *str); *** a/src/test/regress/expected/xml.out --- b/src/test/regress/expected/xml.out *** *** 357,362 SELECT xml 'bar' IS DOCUMENT; --- 357,378 t (1 row) + SELECT xml 'barbar' + barbarbarbarfoo' IS DOCUMENT; ?column? -- *** *** 376,387 SELECT xml 'abc' IS NOT DOCUMENT; (1 row) SELECT '<>' IS NOT DOCUMENT; ERROR: invalid XML content ! LINE 1: SELECT '<>' IS NOT DOCUMENT; !^ ! DETAIL: Entity: line 1: parser error : StartTag: invalid element name ! <> ! ^ SELECT xmlagg(data) FROM xmltest; xmlagg -- --- 392,418 (1 row) SELECT '<>' IS NOT DOCUMENT; + ?column? + -- + t + (1 row) + + SELECT xml 'barbar' ! barbarbarbar' IS DOCUMENT; + SELECT xml 'barbarbarfoo' IS DOCUMENT; SELECT xml '' IS NOT DOCUMENT; SELECT xml 'abc' IS NOT DOCUMENT; SELECT '<>' IS NOT DOCUMENT; + SELECT xml 'barbar -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #5533: PQexecParams in Binary Mode returns incorrect value for float4
Well don't I feel silly! Tom, thank-you for the help - I'll try and get my code debugged before bothering you again On 2/07/10 12:51 AM, "Tom Lane" wrote: > "" writes: >> Some needless speculation: >> 0.75 = 3F40 (as IEEE 32-bit float) >> 0.75 = 3FE8 (as IEEE 64-bit float) >> 1.812500 = 3FE8 (as returned by PQexecParams) >> i.e. the return value is the first 32-bits of the 64-bit representation of >> the correct value. > > Well, yeah. You declared the column as float8, not float4: > >> res = PQexec(conn, "CREATE TABLE testtbl( Intgr int4, Flt float8, PRIMARY > KEY ( Intgr ));"); > > regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
[BUGS] BUG #5536: Disputing output for some Geometric types
The following bug has been logged online: Bug reference: 5536 Logged by: Jon Strait Email address: jstr...@moonloop.net PostgreSQL version: 8.4.4 Operating system: Linux Description:Disputing output for some Geometric types Details: Refering to Documentation section 8.8 (Geometric Types), Boxes are supposed to be output with the format of the first syntax listed, ( (x1, y1), (x2, y2) ), but the output is showing the format of the second syntax, (x1, y1), (x2, y2). Line Segments are being output in a format that is not mentioned in the documentation for Line Segments, [ (x1, y1), (x2, y2) ]. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #5534: IS DOCUMENT predicate errors instead of returning false
On fre, 2010-07-02 at 14:01 +0100, Mike Fowler wrote: > > The attached patch is a very small patch that changes parse_expr.c > to > not convert everything to xml. This now means that when passed > malformed XML it will return false instead of throwing an exception. > In my mind this acceptable as I don't see anywhere in the standard > that mandates that: > > xmlval IS NOT DOCUMENT == xmlval IS CONTENT It says that the declared type of the argument of IS DOCUMENT is XML, which would be invalidated by your patch. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
[BUGS] BUG #5537: Makefile.darwin broken
The following bug has been logged online: Bug reference: 5537 Logged by: Peter Abrahamsen Email address: rainh...@gmail.com PostgreSQL version: 9.0beta2 Operating system: Darwin x86_64 (MacOS 10.6.4) Description:Makefile.darwin broken Details: Makefile.darwin references src/backend/postgres, which doesn't exist. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #5537: Makefile.darwin broken
On Fri, Jul 2, 2010 at 6:15 PM, Peter Abrahamsen wrote: > The following bug has been logged online: > > Bug reference: 5537 > Logged by: Peter Abrahamsen > Email address: rainh...@gmail.com > PostgreSQL version: 9.0beta2 > Operating system: Darwin x86_64 (MacOS 10.6.4) > Description: Makefile.darwin broken > Details: > > Makefile.darwin references src/backend/postgres, which doesn't exist. So what, specifically, is not working for you? I'm using MacOS X 10.6.4 x86_64 also, and I can build Postgres without a problem. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Postgres Company -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #5536: Disputing output for some Geometric types
"Jon Strait" writes: > Refering to Documentation section 8.8 (Geometric Types), Boxes are supposed > to be output with the format of the first syntax listed, ( (x1, y1), (x2, > y2) ), but the output is showing the format of the second syntax, (x1, y1), > (x2, y2). Line Segments are being output in a format that is not mentioned > in the documentation for Line Segments, [ (x1, y1), (x2, y2) ]. Yeah, this documentation seems to be a bit off from the actual behavior of the code. I've adjusted the docs. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs