Re: automatically generating node support functions

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 12:44:00
Message-ID: b9acf63c-6693-d87c-f010-ca8ad502a39f@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06.07.22 22:46, Tom Lane wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> writes:
>> [ v7-0001-Automatically-generate-node-support-functions.patch ]
>
> I have gone through this and made some proposed changes (attached),

I have included those.

> and I think it is almost committable. There is one nasty problem
> we need a solution to, which is that pgindent is not at all on board
> with this idea of attaching node attrs to typedefs. It pushes them
> to the next line, like this:
>
> @@ -691,7 +709,8 @@
> (rel)->reloptkind == RELOPT_OTHER_JOINREL || \
> (rel)->reloptkind == RELOPT_OTHER_UPPER_REL)
>
> -typedef struct RelOptInfo pg_node_attr(no_copy_equal, no_read)
> +typedef struct RelOptInfo
> +pg_node_attr(no_copy_equal, no_read)
> {
> NodeTag type;

I have found that putting the attributes at the end of the struct
definition, right before the semicolon, works, so I have changed it that
way. (This is also where a gcc __attribute__() would go, so it seems
reasonable.)

The attached patch is stable under pgindent.

Finally, I have updated src/backend/nodes/README a bit.

I realize I've been confused various times about when a catversion
change is required when changing nodes. (I think the bump in 251154bebe
was probably not needed.) I have tried to put that in the README. This
could perhaps be expanded.

I think for this present patch, I would do a catversion bump, just to be
sure, in case some of the printed node fields are different now.

It was also my plan to remove the #ifdef OBSOLETE sections in a separate
commit right after, just to be clear.

Final thoughts?

Attachment Content-Type Size
v8-0001-Automatically-generate-node-support-functions.patch text/plain 107.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-07-08 12:56:14 Re: Backup command and functions can cause assertion failure and segmentation fault
Previous Message Bharath Rupireddy 2022-07-08 12:24:13 Re: Patch proposal: New hooks in the connection path