pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Chapman Flack <chap@anastigmatix.net>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: PostgreSQL vs SQL/XML Standards
Date: Sun, 20 Jan 2019 20:07:05 -0500
Message-ID: <5C451B39.90307@anastigmatix.net> (raw )
In-Reply-To: <5C44F26D.5010703@anastigmatix.net >
References: <CAFj8pRDFQJMoKf-X+3p1ASwU02nnXfAXrg83Z3fHUBd-Gwuuxw@mail.gmail.com >
<5C283168.8060001@anastigmatix.net >
<CAFj8pRDRrxyr8=2PEFxP_eZCRqJMU4Jpj0whJM9pX0V4Q4EQvw@mail.gmail.com >
<5C291741.9060506@anastigmatix.net >
<CAFj8pRAmSUO1g1qnVgXmE=7bPULYjwDfyO5KDohsHMFesDenmA@mail.gmail.com >
<5C297BB7.9070509@anastigmatix.net >
<CAFj8pRCN=0k507nTfvNQuruHvomA4SiC6uGUXY5Gz0crxf-JAQ@mail.gmail.com >
<5C3A7A90.3070207@anastigmatix.net >
<CAFj8pRCSa0ekwc8AOUnEsLeJhWbq7_rOyFzruopfgBTaMpUWMA@mail.gmail.com >
<5C43FAEB.2070000@anastigmatix.net >
<CAFj8pRDLywawDY-dRsYdjF036iR_Y4em77X1DF7VodUqau_0Vg@mail.gmail.com >
<5C4401BE.4080606@anastigmatix.net >
<CAFj8pRCKwDGqP55RTykDq87DXuXStE+3Qy2Hf9Wxh_A-cUnwTw@mail.gmail.com >
<5C449C71.7060903@anastigmatix.net >
<CAFj8pRAabQWW13FS58fj1h6YxKsbhEaegRctf28TFeheWGn_3A@mail.gmail.com >
<5C44B332.6070609@anastigmatix.net >
<CAFj8pRAfjUJZX3so2TooQvag2C+5b1+sm4rzZuJkuO5UtDtkhg@mail.gmail.com >
<5C44F26D.5010703@anastigmatix.net >
On 01/20/19 17:13, Chapman Flack wrote:
> On 01/20/19 12:48, Pavel Stehule wrote:
>> regular Postgres' functions has evaluated all arguments before own
>> execution. I think so this note is related much more to expressions used as
>> defaults.
>
> Sure, but again, is there an example, or can one easily be constructed,
> that shows the default expressions working in such a way?
To make my question more concrete, here is the current regression test
query that uses an SQL expression for a default:
SELECT xmltable.*
FROM
xmltest2,
xmltable(('/d/r/' || lower(_path) || 'c')
PASSING x
COLUMNS a int PATH 'x' DEFAULT ascii(_path) - 54);
a
----
11
12
13
14
(4 rows)
Here is the same query desugared into a call of the PL/Java "xmltable":
SELECT xmltable.*
FROM
xmltest2,
LATERAL (SELECT x AS ".", ascii(_path) - 54 AS "A_DFT") AS p,
"xmltable"(('/d/r/' || lower(_path) || 'c'),
PASSING => p,
COLUMNS => ARRAY[
'let $a := x return xs:int(if (exists($a)) then $a else $A_DFT)'
]
) AS (a int);
a
----
11
12
13
14
(4 rows)
So the PL/Java version works and produces the same results. And yet
it certainly is a "regular PostgreSQL function" made with CREATE FUNCTION,
no special treatment of arguments, all evaluated before entry in the usual
way.
So it appears that this example does not depend on any special treatment
of the default_expression.
Is there an example that can be constructed that would depend on the
special treatment (in which case, the PL/Java implementation would be
unable to produce the same result)?
Regards,
-Chap
... the xs:int(...) cast above is needed for now, just because the PL/Java
implementation does not yet include the standard's algorithm to find
the right cast automatically.
view thread (88+ messages) latest in thread
Message-ID: <5C451B39.90307@anastigmatix.net>
Permalink: ../5C451B39.90307@anastigmatix.net/
Also on: postgresql.org/message-id/5C451B39.90307@anastigmatix.net
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: chap@anastigmatix.net, pavel.stehule@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: PostgreSQL vs SQL/XML Standards
In-Reply-To: <5C451B39.90307@anastigmatix.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox