Re: automatically generating node support functions

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: automatically generating node support functions
Date: 2022-03-24 21:57:29
Message-ID: CAApHDvppoxUxzRJbwF9oOF12ngdfNoPEMfDsu63+LREgGnheUw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 18 Feb 2022 at 19:52, Peter Eisentraut
<peter(dot)eisentraut(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-03-24 21:58:22 Re: New Object Access Type hooks
Previous Message Robert Haas 2022-03-24 21:56:48 fixing a few backup compression goofs