Re: Cleaning up ERRCODE usage in our XML code

2025-04-09 Thread Chapman Flack
On 04/09/25 10:03, Tom Lane wrote: > I think I stole it from DB2: > > 10608 An error was encountered in the argument of an XQuery function or > operator. Interesting. ISO does seem to reserve a class 10 for XQuery errors, but not to define any subclass codes within it. Every other SQL/XML error

Re: Cleaning up ERRCODE usage in our XML code

2025-04-09 Thread Tom Lane
Peter Eisentraut writes: > On 14.09.24 21:14, Tom Lane wrote: >> +Section: Class 10 - XQuery Error >> + >> +# recent SQL versions define quite a few codes in this class, but for now >> +# we are only using this generic one >> +10608EERRCODE_INVALID_ARGUMENT_FOR_XQUERY

Re: Cleaning up ERRCODE usage in our XML code

2025-04-09 Thread Peter Eisentraut
On 14.09.24 21:14, Tom Lane wrote: +Section: Class 10 - XQuery Error + +# recent SQL versions define quite a few codes in this class, but for now +# we are only using this generic one +10608EERRCODE_INVALID_ARGUMENT_FOR_XQUERY invalid_argument_for_xquery Coul

Re: Cleaning up ERRCODE usage in our XML code

2024-09-24 Thread Tom Lane
Daniel Gustafsson writes: > On 23 Sep 2024, at 19:17, Tom Lane wrote: >> Yeah, I looked at that but wasn't sure what to do with it. We should >> have validated the decl header when the XML value was created, so if >> we get here then either the value got corrupted on-disk or in-transit, >> or so

Re: Cleaning up ERRCODE usage in our XML code

2024-09-23 Thread Daniel Gustafsson
> On 23 Sep 2024, at 19:17, Tom Lane wrote: > Daniel Gustafsson writes: > >> There is an ERRCODE_INTERNAL_ERROR in xml_out_internal() which seems a tad >> odd >> given that any error would be known to be parsing related and b) are caused >> by >> libxml and not internally. Not sure if it's wo

Re: Cleaning up ERRCODE usage in our XML code

2024-09-23 Thread Tom Lane
Daniel Gustafsson writes: >> On 20 Sep 2024, at 21:00, Tom Lane wrote: >> Per cfbot, rebased over d5622acb3. No functional changes. > Looking over these I don't see anything mis-characterized so +1 on going ahead > with these. It would be neat if we end up translating xml2 errors into XQuery >

Re: Cleaning up ERRCODE usage in our XML code

2024-09-23 Thread Daniel Gustafsson
> On 20 Sep 2024, at 21:00, Tom Lane wrote: > > I wrote: >> [ v1-clean-up-errcodes-for-xml.patch ] > > Per cfbot, rebased over d5622acb3. No functional changes. Looking over these I don't see anything mis-characterized so +1 on going ahead with these. It would be neat if we end up translating

Re: Cleaning up ERRCODE usage in our XML code

2024-09-20 Thread Tom Lane
I wrote: > [ v1-clean-up-errcodes-for-xml.patch ] Per cfbot, rebased over d5622acb3. No functional changes. regards, tom lane diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index 0fdf735faf..ef78aa00c8 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.

Cleaning up ERRCODE usage in our XML code

2024-09-14 Thread Tom Lane
I noticed while working on bug #18617 [1] that we are fairly slipshod about which SQLSTATE to report when libxml2 returns an error. There are places using ERRCODE_INTERNAL_ERROR for easily-triggered errors; there are different places that use different ERRCODEs for exactly the same condition; and