Re: automatically generating node support functions

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: David Rowley <dgrowleyml@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-07-08T20:03:45Z
Lists: pgsql-hackers

Attachments

Peter Eisentraut <peter.eisentraut@enterprisedb.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

Commits

  1. Fix MSVC build script's check for obsolete node support functions.

  2. Improve performance of ORDER BY / DISTINCT aggregates

  3. doc: Fix typos in protocol.sgml

  4. Tighten up parsing logic in gen_node_support.pl.

  5. Add defenses against unexpected changes in the NodeTag enum list.

  6. Add copy/equal support for XID lists

  7. Rationalize order of input files for gen_node_support.pl.

  8. Make assorted quality-of-life improvements in gen_node_support.pl.

  9. Doc: rearrange high-level commentary about node support coverage.

  10. Automatically generate node support functions

  11. Adjust node serialization tag of A_Expr for consistency

  12. Remove T_Join and T_Plan

  13. Reformat some more node comments

  14. Reformat some node comments

  15. Remove JsonPathSpec typedef

  16. Add missing enum tag in enum used in nodes

  17. Add Cardinality typedef

  18. Make node output prefix match node structure name

  19. Add WRITE_INDEX_ARRAY

  20. Add COPY_ARRAY_FIELD and COMPARE_ARRAY_FIELD

  21. Remove T_Expr

  22. Change NestPath node to contain JoinPath node

  23. Change SeqScan node to contain Scan node

  24. Check the size in COPY_POINTER_FIELD

  25. Remove T_MemoryContext

  26. Add missing enum tags in enums used in nodes

  27. Rename some node support functions for consistency

  28. Rename argument of _outValue()

  29. Rename NodeTag of ExprState