Re: Improve node type forward reference

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve node type forward reference
Date: 2024-10-17 06:41:09
Message-ID: d8464d62-b605-4de1-8efd-fb7ce5de1640@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 15.10.24 16:43, Nathan Bossart wrote:
> On Tue, Oct 15, 2024 at 09:02:48AM +0200, Peter Eisentraut wrote:
>> On 14.10.24 23:28, Nathan Bossart wrote:
>>> On Mon, Oct 14, 2024 at 09:47:59AM +0200, Peter Eisentraut wrote:
>>>> But we can do this better by using an incomplete struct, like
>>>>
>>>> struct Query *viewQuery ...;
>>>>
>>>> That way, everything has the correct type and fewer casts are required. This
>>>> technique is already used elsewhere in node type definitions.
>>>
>>> I noticed that the examples in parsenodes.h are for structs defined within
>>> the same file. If the struct is defined in a separate file, I guess you
>>> might need to include another header file wherever it is used, but that
>>> doesn't seem too bad.
>>
>> No, you can leave the struct incomplete. You only need to provide its full
>> definition (= include the other header file) if you actually want to access
>> the struct's fields.
>
> That's what I figured. This one LGTM, too, then.

Committed, thanks.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anthonin Bonnefoy 2024-10-17 07:21:11 Re: Set query_id for query contained in utility statement
Previous Message Peter Eisentraut 2024-10-17 06:28:36 Re: [PoC] Federated Authn/z with OAUTHBEARER