Re: [PoC] XMLCast (SQL/XML X025)

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Vik Fearing <vik(at)postgresfriends(dot)org>
Subject: Re: [PoC] XMLCast (SQL/XML X025)
Date: 2025-11-29 12:38:32
Message-ID: 531ef48a-c566-400a-b753-e4a349e3c987@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 29/11/2025 12:38, Marcos Pegoraro wrote:
> Em sex., 28 de nov. de 2025 às 17:07, Jim Jones <jim(dot)jones(at)uni-
> muenster.de <mailto:jim(dot)jones(at)uni-muenster(dot)de>> escreveu:
>
> Character data type in this sentence means the character types[1] as a
> category, not the type character or character varying.
>
> Yes, I understand that, but  saying character confuses me a bit.

Perhaps listing the data types would make things easier to understand?
Something like:

* Casting is supported between xml and the built-in character
(character, character varying, or text), numeric, boolean, binary, and
date/time types. The date/time types (date, time with time zone,
timestamp with time zone, and interval) are converted to their
corresponding XML Schema types: xs:date, xs:time, xs:dateTime, and
xs:duration.

A bit too verbose for my taste, but I could live with it.

XMLSerialize does something similar:

"type can be character, character varying, or text..."

What do you think?

> Not really. XMLCast implements the type-specific lexical and semantic
> rules defined by SQL/XML, which apply only to base (non-domain) data
> types. Although the grammar permits a domain name as a target, the
> standard does not define any XML-specific semantics for domains.
> Supporting them would go beyond the scope of this patch, and users
> who need a domain can IMHO cast the XMLCast result afterward.
>
> Correct. So maybe would be fine to explain this on SGML part, because a
> domain is sometimes used just as an alias of a base type, without
> checking or any other feature.

If the user gets a "ERROR: unsupported target data type for XMLCast"
using a domain (being an alias for a base type or not) and the
documentation clearly lists the supported types, wouldn't that be
enough? If not, do you have anything in mind that we could add to the docs?

Thanks for the review

Best, Jim

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2025-11-29 12:42:56 Re: Second RewriteQuery complains about first RewriteQuery in edge case
Previous Message Sugamoto Shinya 2025-11-29 12:36:59 Re: [PATCH] Add error hints for invalid COPY options