Re: automatically generating node support functions - Mailing list pgsql-hackers

From David Rowley
Subject Re: automatically generating node support functions
Date
Msg-id CAApHDvppoxUxzRJbwF9oOF12ngdfNoPEMfDsu63+LREgGnheUw@mail.gmail.com
Whole thread Raw
In response to Re: automatically generating node support functions  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: automatically generating node support functions
List pgsql-hackers
On Fri, 18 Feb 2022 at 19:52, Peter Eisentraut
<peter.eisentraut@enterprisedb.com> wrote:
> [ v5-0001-Automatically-generate-node-support-functions.patch ]

I've been looking over the patch and wondering the best way to move
this forward.

But first a couple of things I noted down from reading the patch:

1. You're written:

 * Unknown attributes are ignored.  Some additional attributes are used for
 * special "hack" cases.

I think these really should all be documented.  If someone needs to
use one of these hacks then they're going to need to trawl through
Perl code to see if you've implemented something that matches the
requirements.  I'd personally rather not have to look at the Perl code
to find out which attributes I need to use for my new field. I'd bet
I'm not the only one.

2. Some of these comment lines have become pretty long after having
added the attribute macro.

e.g.

PlannerInfo *subroot pg_node_attr(readwrite_ignore); /* modified
"root" for planning the subquery;
   not printed, too large, not interesting enough */

I wonder if you'd be better to add a blank line above, then put the
comment on its own line, i.e:

 /* modified "root" for planning the subquery; not printed, too large,
not interesting enough */
PlannerInfo *subroot pg_node_attr(readwrite_ignore);

3. My biggest concern with this patch is it introducing some change in
behaviour with node copy/equal/read/write.  I spent some time in my
diff tool comparing the files the Perl script built to the existing
code.  Unfortunately, that job is pretty hard due to various order
changes in the outputted functions.  I wonder if it's worth making a
pass in master and changing the function order to match what the
script outputs so that a proper comparison can be done just before
committing the patch.   The problem I see is that master is currently
a very fast-moving target and a detailed comparison would be much
easier to do if the functions were in the same order. I'd be a bit
worried that someone might commit something that requires some special
behaviour and that commit goes in sometime between when you've done a
detailed and when you commit the full patch.

Although, perhaps you've just been copying and pasting code into the
correct order before comparing, which might be good enough if it's
simple enough to do.

I've not really done any detailed review of the Perl code. I'm not the
best person for that, but I do feel like the important part is making
sure the outputted files logically match the existing files.

Also, I'm quite keen to see this work make it into v15.  Do you think
you'll get time to do that? Thanks for working on it.

David



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: fixing a few backup compression goofs
Next
From: Andres Freund
Date:
Subject: Re: New Object Access Type hooks