From: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Extending outfuncs support to utility statements |
Date: | 2022-08-24 15:25:31 |
Message-ID: | 2e7adbce-2ff5-866e-8753-9969b0ce332b@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 13.07.22 00:38, Tom Lane wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> writes:
>> This is also needed to be able to store utility statements in (unquoted)
>> SQL function bodies. I have some in-progress code for that that I need
>> to dust off. IIRC, there are still some nontrivial issues to work
>> through on the reading side. I don't have a problem with enabling the
>> outfuncs side in the meantime.
>
> BTW, I experimented with trying to enable WRITE_READ_PARSE_PLAN_TREES
> for utility statements, and found that the immediate problem is that
> Constraint and a couple of other node types lack read functions
> (they're the ones marked "custom_read_write, no_read" in parsenodes.h).
> They have out functions, so writing the inverses seems like it's just
> something nobody ever got around to. Perhaps there are deeper problems
> lurking behind that one, though.
Here are patches for that.
v1-0001-Fix-reading-of-most-negative-integer-value-nodes.patch
v1-0002-Fix-reading-of-BitString-nodes.patch
These are some of those lurking problems.
v1-0003-Add-read-support-for-some-missing-raw-parse-nodes.patch
This adds the read support for the missing nodes.
The above patches are candidates for committing.
At this point we have one structural problem left: char * node fields
output with WRITE_STRING_FIELD() (ultimately outToken()) don't
distinguish between empty strings and NULL values. A write/read
roundtrip ends up as NULL for an empty string. This shows up in the
regression tests for commands such as
CREATE TABLESPACE regress_tblspace LOCATION '';
CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' ...
This will need some expansion of the output format to handle this.
v1-0004-XXX-Turn-on-WRITE_READ_PARSE_PLAN_TREES-for-testi.patch
v1-0005-Implement-WRITE_READ_PARSE_PLAN_TREES-for-raw-par.patch
v1-0006-Enable-WRITE_READ_PARSE_PLAN_TREES-of-rewritten-u.patch
This is for testing the above. Note that in 0005 we need some special
handling for float values to preserve the full precision across
write/read. I suppose this could be unified with the code the preserves
the location fields when doing write/read checking.
v1-0007-Enable-utility-statements-in-unquoted-SQL-functio.patch
This demonstrates what the ultimate goal is. A few more tests should be
added eventually.
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Fix-reading-of-most-negative-integer-value-nodes.patch | text/plain | 1.5 KB |
v1-0002-Fix-reading-of-BitString-nodes.patch | text/plain | 1.5 KB |
v1-0003-Add-read-support-for-some-missing-raw-parse-nodes.patch | text/plain | 9.4 KB |
v1-0004-XXX-Turn-on-WRITE_READ_PARSE_PLAN_TREES-for-testi.patch | text/plain | 806 bytes |
v1-0005-Implement-WRITE_READ_PARSE_PLAN_TREES-for-raw-par.patch | text/plain | 3.4 KB |
v1-0006-Enable-WRITE_READ_PARSE_PLAN_TREES-of-rewritten-u.patch | text/plain | 2.5 KB |
v1-0007-Enable-utility-statements-in-unquoted-SQL-functio.patch | text/plain | 3.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2022-08-24 15:30:08 | Re: [RFC] building postgres with meson - v11 |
Previous Message | Andres Freund | 2022-08-24 15:16:41 | Re: ecpg assertion on windows |