Re: automatically generating node support functions

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

Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> writes:
> On 08.07.22 15:52, Tom Lane wrote:
>> I'll re-read the patch today, but how open are you to putting the
>> struct attributes at the top? I'm willing to do the legwork.

> I agree near the top would be preferable. I think it would even be
> feasible to parse the whole thing if pgindent split it across lines. I
> sort of tried to maintain the consistency with C/C++ attributes like
> __attribute__ and [[attribute]], hoping that that would confuse other
> tooling the least. Feel free to experiment further.

I went through and did that, and I do like this way better.

I did a final round of review, and found a few cosmetic things, as
well as serious bugs in the code I'd contributed for copy_as/read_as:
they did the wrong thing for VALUE of "0" because I should have
written "if (defined $foo)" not "if ($foo)". Also, read_as did
not generate correct code for the case where we don't have
read_write_ignore; in that case we have to read the value outfuncs.c
wrote and then override it.

0001 attached repeats your v8 (to please the cfbot).

0002 includes some suggestions for the README file as well as
cosmetic and not-so-cosmetic fixes for gen_node_support.pl.

0003 moves the node-level attributes as discussed.

Lastly, I think we ought to apply pgperltidy to the Perl code.
In case you don't have that installed, 0004 is the diffs I got.

I think this is ready to go (don't forget the catversion bump).

regards, tom lane

Attachment Content-Type Size
v8-0001-Automatically-generate-node-support-functions.patch text/x-diff 107.5 KB
v8-0002-miscellaneous-fixes.patch text/x-diff 9.8 KB
v8-0003-move-struct-attributes.patch text/x-diff 25.2 KB
v8-0004-apply-pgperltidy.patch text/x-diff 25.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-07-08 20:16:07 Re: automatically generating node support functions
Previous Message Erik Rijkers 2022-07-08 20:03:00 SQL/JSON documentation JSON_TABLE