Re: automatically generating node support functions

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-02-18T06:51:56Z
Lists: pgsql-hackers

Attachments

On 14.02.22 18:09, Tom Lane wrote:
> * It's time for action on the business about extracting comments
> from the to-be-deleted code.

done

> * The Perl script is kind of under-commented for my taste.
> It lacks a copyright notice, too.

done

> * In the same vein, I should not have to reverse-engineer what
> the available pg_node_attr() properties are or do.  Perhaps they
> could be documented in the comment for the pg_node_attr macro
> in nodes.h.

done

> * Maybe the generated file names could be chosen less opaquely,
> say ".funcs" and ".switch" instead of ".inc1" and ".inc2".

done

> * I don't understand why there are changes in the #include
> lists in copyfuncs.c etc?

Those are #include lines required for the definitions of various 
structs.  Since the generation script already knows which header files 
are relevant (they are its input files), it can just generate the 
required #include lines as well.  That way, the remaining copyfuncs.c 
only has #include lines for things that the (remaining) file itself 
needs, not what the files included by it need, and if a new header file 
were to be added, it doesn't have to be added in 4+ places.

> * I think that more thought needs to be put into the format
> of the *nodes.h struct declarations, because I fear pgindent
> is going to make a hash of what you've done here.  When we
> did similar stuff in the catalog headers, I think we ended
> up moving a lot of end-of-line comments onto their own lines.

I have tested pgindent repeatedly throughout this project, and it 
doesn't look too bad.  You are right that some manual curation of 
comment formatting would be sensible, but I think that might be better 
done as a separate patch.

> * I assume the pg_config_manual.h changes are not meant for
> commit?

right

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