Re: XMLDocument (SQL/XML X030) - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: XMLDocument (SQL/XML X030)
Date
Msg-id 6794F0BE.6070302@acm.org
Whole thread Raw
In response to Re: XMLDocument (SQL/XML X030)  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: XMLDocument (SQL/XML X030)
List pgsql-hackers
On 01/25/25 02:16, Pavel Stehule wrote:
> because the function does nothing, then it is useless to convert input to
> XML and force detosting
> 
> Maybe the body of the function should be just
> ...
>   PG_RETURN_DATUM(PG_GETARG_DATUM(0));

That sort of motivated my question upthread about whether there is
already a function somewhere in the codebase that does exactly that
and could be named in the pg_proc entry for xmldocument, as an
alternative to supplying a brand-new one.

Maybe this is the only instance where it turns out that 'identity'
is the right behavior for a function. But if it could conceivably
happen again, a single C function (maybe even named identity) could
reduce code duplication and make quite clear what the behavior is
with a \sf.

A generic 'identity' function would be lacking the #ifdef USE_LIBXML
and the error message, but I'm not convinced those matter here
anyway. Without XML support, you'll already have raised that error
in any attempt to construct a non-null XML argument to pass, and if
you're passing NULL and the function is strict, you'll never see
the error message from here anyway.

Regards,
-Chap




pgsql-hackers by date:

Previous
From: Shlok Kyal
Date:
Subject: Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility.
Next
From: Pavel Stehule
Date:
Subject: Re: XMLDocument (SQL/XML X030)