Re: [HACKERS] review: xml_is_well_formed

2010-08-13 Thread Tom Lane
Mike Fowler writes: > On 11/08/10 21:27, Tom Lane wrote: >> Yes. Mike, are you expecting to submit a new version before the end of >> the week? > Yes and here it is, apologies for the delay. I have re-implemented > xml_is_well_formed such that it is sensitive to the XMLOPTION. The > additional

Re: [HACKERS] review: xml_is_well_formed

2010-08-12 Thread Pavel Stehule
Hello I checked last version: * there are not a problem with regress and contrib regress tests * the design is simple and clean now - well documented notes: * don't get a patch via copy/paste from mailing list archive - there are a broken xml2 tests via this access! * I didn't find a sentence so

Re: [HACKERS] review: xml_is_well_formed

2010-08-11 Thread Mike Fowler
On 11/08/10 21:27, Tom Lane wrote: Robert Haas writes: On Mon, Aug 9, 2010 at 10:41 AM, Robert Haas wrote: There's also the fact that it would probably end up parsing the data twice. Given xmloption, I'm inclined to think Tom has it right: provided xml_is_well_formed() that follows xmloption

Re: [HACKERS] review: xml_is_well_formed

2010-08-11 Thread Tom Lane
Robert Haas writes: > On Mon, Aug 9, 2010 at 10:41 AM, Robert Haas wrote: >> There's also the fact that it would probably end up parsing the data >> twice.  Given xmloption, I'm inclined to think Tom has it right: >> provided xml_is_well_formed() that follows xmloption, plus a specific >> version

Re: [HACKERS] review: xml_is_well_formed

2010-08-11 Thread Robert Haas
On Mon, Aug 9, 2010 at 10:41 AM, Robert Haas wrote: > On Mon, Aug 9, 2010 at 10:20 AM, Peter Eisentraut wrote: >> On lör, 2010-08-07 at 16:47 +0100, Mike Fowler wrote: >>> To be honest I'm happiest with returning a boolean, even if there is >>> some confusion over content only being valid. Though

Re: [HACKERS] review: xml_is_well_formed

2010-08-09 Thread Robert Haas
On Mon, Aug 9, 2010 at 10:20 AM, Peter Eisentraut wrote: > On lör, 2010-08-07 at 16:47 +0100, Mike Fowler wrote: >> To be honest I'm happiest with returning a boolean, even if there is >> some confusion over content only being valid. Though changing the >> return >> value to DOCUMENT/CONTENT/NULL

Re: [HACKERS] review: xml_is_well_formed

2010-08-09 Thread Peter Eisentraut
On lör, 2010-08-07 at 16:47 +0100, Mike Fowler wrote: > To be honest I'm happiest with returning a boolean, even if there is > some confusion over content only being valid. Though changing the > return > value to DOCUMENT/CONTENT/NULL makes things a touch more explicit, > the > same results can

Re: [HACKERS] review: xml_is_well_formed

2010-08-08 Thread Robert Haas
On Sun, Aug 8, 2010 at 1:45 PM, Tom Lane wrote: > Peter Eisentraut writes: >> On lör, 2010-07-31 at 13:40 -0400, Robert Haas wrote: >>> I think the point of this function is to determine whether a cast to >>> xml will throw an error.  The behavior should probably match exactly >>> whatever test w

Re: [HACKERS] review: xml_is_well_formed

2010-08-08 Thread Tom Lane
Peter Eisentraut writes: > On lör, 2010-07-31 at 13:40 -0400, Robert Haas wrote: >> I think the point of this function is to determine whether a cast to >> xml will throw an error. The behavior should probably match exactly >> whatever test would be applied there. > Maybe there should be > xml

Re: [HACKERS] review: xml_is_well_formed

2010-08-07 Thread Mike Fowler
On 06/08/10 21:55, Peter Eisentraut wrote: On fre, 2010-08-06 at 14:43 +0100, Mike Fowler wrote: Or perhaps it could return a string instead of a boolean: content, document, or NULL if it's neither. I like the sound of that. In fact this helps workaround the IS DOCUMENT and IS CONTENT limitat

Re: [HACKERS] review: xml_is_well_formed

2010-08-06 Thread Robert Haas
On Fri, Aug 6, 2010 at 4:52 PM, Peter Eisentraut wrote: > On fre, 2010-08-06 at 07:31 -0400, Robert Haas wrote: >> > What about making the function sensitive to the XML OPTION, such >> that: >> > >> > test=# SET xmloption TO DOCUMENT; >> > SET >> > text=# SELECT xml_is_well_formed('foo'); >> > >>

Re: [HACKERS] review: xml_is_well_formed

2010-08-06 Thread Peter Eisentraut
On fre, 2010-08-06 at 14:43 +0100, Mike Fowler wrote: > > Or perhaps it could return a string instead of a boolean: content, > > document, or NULL if it's neither. > > > > I like the sound of that. In fact this helps workaround the IS > DOCUMENT > and IS CONTENT limitations such that you can

Re: [HACKERS] review: xml_is_well_formed

2010-08-06 Thread Peter Eisentraut
On fre, 2010-08-06 at 07:31 -0400, Robert Haas wrote: > > What about making the function sensitive to the XML OPTION, such > that: > > > > test=# SET xmloption TO DOCUMENT; > > SET > > text=# SELECT xml_is_well_formed('foo'); > > > > xml_is_well_formed > > > > f > > (1 row)

Re: [HACKERS] review: xml_is_well_formed

2010-08-06 Thread Mike Fowler
On 06/08/10 12:31, Robert Haas wrote: Maybe there should be xml_is_well_formed() xml_is_well_formed_document() xml_is_well_formed_content() I agree that consistency with SQL/XML is desirable, but for someone coming from the outside, the unqualified claim that 'foo' is well-formed XML might sou

Re: [HACKERS] review: xml_is_well_formed

2010-08-06 Thread Robert Haas
On Fri, Aug 6, 2010 at 4:28 AM, Mike Fowler wrote: > On 03/08/10 16:15, Peter Eisentraut wrote: >> >> On lör, 2010-07-31 at 13:40 -0400, Robert Haas wrote: Well-formedness should probably only allow XML documents. >>> >>> I think the point of this function is to determine whether a cast

Re: [HACKERS] review: xml_is_well_formed

2010-08-06 Thread Mike Fowler
On 03/08/10 16:15, Peter Eisentraut wrote: On lör, 2010-07-31 at 13:40 -0400, Robert Haas wrote: Well-formedness should probably only allow XML documents. I think the point of this function is to determine whether a cast to xml will throw an error. The behavior should probably match exactly w

Re: [HACKERS] review: xml_is_well_formed

2010-08-03 Thread Pavel Stehule
Hello 2010/8/3 Peter Eisentraut : > On lör, 2010-07-31 at 13:40 -0400, Robert Haas wrote: >> > Well-formedness should probably only allow XML documents. >> >> I think the point of this function is to determine whether a cast to >> xml will throw an error.  The behavior should probably match exactl

Re: [HACKERS] review: xml_is_well_formed

2010-08-03 Thread Peter Eisentraut
On lör, 2010-07-31 at 13:40 -0400, Robert Haas wrote: > > Well-formedness should probably only allow XML documents. > > I think the point of this function is to determine whether a cast to > xml will throw an error. The behavior should probably match exactly > whatever test would be applied there

Re: [HACKERS] review: xml_is_well_formed

2010-08-02 Thread Mike Fowler
On 02/08/10 07:46, Pavel Stehule wrote: I have not any suggestions now - so I'll change flag to "ready to commit" sorry - contrib module should be a fixed patch attached Thanks Pavel, you saved me some time! Regards, -- Mike Fowler Registered Linux user: 379787 -- Sent via pgsql-hacker

Re: [HACKERS] review: xml_is_well_formed

2010-08-01 Thread Pavel Stehule
2010/8/2 Pavel Stehule : > 2010/7/31 Robert Haas : >> On Sat, Jul 31, 2010 at 8:10 AM, Peter Eisentraut wrote: >>> On fre, 2010-07-30 at 12:50 +0100, Mike Fowler wrote: > * xml_is_well_formed returns true for simple text > > postgres=# SELECT xml_is_well_formed(''); >   xml

Re: [HACKERS] review: xml_is_well_formed

2010-08-01 Thread Pavel Stehule
2010/7/31 Robert Haas : > On Sat, Jul 31, 2010 at 8:10 AM, Peter Eisentraut wrote: >> On fre, 2010-07-30 at 12:50 +0100, Mike Fowler wrote: >>> > * xml_is_well_formed returns true for simple text >>> > >>> > postgres=# SELECT xml_is_well_formed(''); >>> >   xml_is_well_formed >>> > ---

Re: [HACKERS] review: xml_is_well_formed

2010-07-31 Thread Robert Haas
On Sat, Jul 31, 2010 at 8:10 AM, Peter Eisentraut wrote: > On fre, 2010-07-30 at 12:50 +0100, Mike Fowler wrote: >> > * xml_is_well_formed returns true for simple text >> > >> > postgres=# SELECT xml_is_well_formed(''); >> >   xml_is_well_formed >> > >> >   t >> > (1 row)

Re: [HACKERS] review: xml_is_well_formed

2010-07-31 Thread Peter Eisentraut
On fre, 2010-07-30 at 12:50 +0100, Mike Fowler wrote: > > * xml_is_well_formed returns true for simple text > > > > postgres=# SELECT xml_is_well_formed(''); > > xml_is_well_formed > > > > t > > (1 row) > > > > it is probably wrong result - is it ok?? > > > > Yes t

Re: [HACKERS] review: xml_is_well_formed

2010-07-30 Thread Pavel Stehule
Hello 2010/7/30 Mike Fowler : > Hi Pavel, > > Thanks for taking the time to review my patch. Attached is a new version > addressing your concerns. > > On 29/07/10 14:21, Pavel Stehule wrote: >> >> I have a few issues: >> * broken regress test (fedora 13 - xmllint: using libxml version 20707) ok -

Re: [HACKERS] review: xml_is_well_formed

2010-07-30 Thread Mike Fowler
Hi Pavel, Thanks for taking the time to review my patch. Attached is a new version addressing your concerns. On 29/07/10 14:21, Pavel Stehule wrote: I have a few issues: * broken regress test (fedora 13 - xmllint: using libxml version 20707) postgres=# SELECT xml_is_well_formed('http://postg

[HACKERS] review: xml_is_well_formed

2010-07-29 Thread Pavel Stehule
Hello I looked on patch https://commitfest.postgresql.org/action/patch_view?id=334 .This patch moves function xml_is_well_formed from contrib xm2 to core. * Is the patch in context diff format? yes * Does it apply cleanly to the current CVS HEAD? yes * Does it include reasonable tests, necessa