From: Michael Paquier <michael@paquier.xyz>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: 邱宇航 <iamqyh@gmail.com>
Subject: Re: Thread-safe stringToNode() / pg_strtok()
Date: Sun, 23 Aug 2026 06:38:58 +0900
Message-ID: <aooW8v7_96lmaR1e@paquier.xyz> (raw)
In-Reply-To: <CAEze2WgY-ejEcyOu5SadL5=OQdda0C-39Hs+C3fH_uQ5MTX6jQ@mail.gmail.com>
References: <CAEze2WjsGnOM4MB+n1LLdhhUg6r=hwWZRv+-heDE4UtzRdgjyg@mail.gmail.com>
<aoFjAh0H7VBmhsZX@paquier.xyz>
<CAEze2Wgrv-nUcD_7tLP0Nzm1EtJCkQqn4_27+OH6m-55y_gUgw@mail.gmail.com>
<67e173d6-8be7-4aea-9615-745acb4877da@eisentraut.org>
<CAEze2WheHx03p1Cqxua-3OmqeDKBey=T7vZGfNZ2Cug7vEMR+A@mail.gmail.com>
<aofW6ntfWJjk_yBL@paquier.xyz>
<CAEze2WhQVAVOJoS=01Za=WCwr-KUxY+iqwpKSnOZrKgkZxkVZQ@mail.gmail.com>
<aojjkj79x5lmcm_Q@paquier.xyz>
<CAEze2WgY-ejEcyOu5SadL5=OQdda0C-39Hs+C3fH_uQ5MTX6jQ@mail.gmail.com>
On Sat, Aug 22, 2026 at 10:16:44PM +0200, Matthias van de Meent wrote:
> I've moved them to readfuncs.h, which I think is a reasonable
> compromise; avoiding the forward declaration whilst still exposing
> these functions to extensions that might need them.
The forward declaration feeling unnecessary was my main grip, so I am
fine with the suggestion of moving them to readfuncs.c.
> There's a "shardman" repo that seems to directly use readOidCols:
> https://github.com/ZhaoDiankui/shardman/blob/merge/src/exchange.c#L162
Noted.
> Apache AGE seems to use (or at least, reference) our read*Cols
> definitions in their backend/nodes/cypher_readfuncs.c; in copied
> macros that don't currently seem to have any usage but might get used
> in the future. Its READ_BITMAP_FIELD macro won't work as-is (it
> references _readBitmap, which is the private/static version, whereas
> readBitmap is the exposed version).
I saw this one, but it just looked like a copy-paste of the
readfuncs.c code to me, not a legit call.
> * new 0001 patch, which moves the read* functions from nodes.h to readfuncs.h.
> As was discussed upthread. 0002 is adjusted accordingly.
OK for this one here.
> * nodes/extensible.h now includes nodes/readfuncs.h
> I revised my opinion on this: I noticed my compiler complained
> about the plain "struct ReadNodeContext *ctx" argument if I didn't put
> a "struct ReadNodeContext;" declaration at the top level of the file,
> which (when combined with relevant comments) would add more verbose
> clutter than the alternative of including nodes/readfuncs.h.
Avoiding the struct markers when we can is a better practice to me.
Digression: We still have a few places in the code where we have these
markers, I think, perhaps they could be cleaned up..
> * adjusted comment on parseNodeString, as reported upthread.
Thanks.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: michael@paquier.xyz, boekewurm+postgres@gmail.com, peter@eisentraut.org, hlinnaka@iki.fi, iamqyh@gmail.com
Subject: Re: Thread-safe stringToNode() / pg_strtok()
In-Reply-To: <aooW8v7_96lmaR1e@paquier.xyz>
References: <CAEze2WjsGnOM4MB+n1LLdhhUg6r=hwWZRv+-heDE4UtzRdgjyg@mail.gmail.com> <aoFjAh0H7VBmhsZX@paquier.xyz> <CAEze2Wgrv-nUcD_7tLP0Nzm1EtJCkQqn4_27+OH6m-55y_gUgw@mail.gmail.com> <67e173d6-8be7-4aea-9615-745acb4877da@eisentraut.org> <CAEze2WheHx03p1Cqxua-3OmqeDKBey=T7vZGfNZ2Cug7vEMR+A@mail.gmail.com> <aofW6ntfWJjk_yBL@paquier.xyz> <CAEze2WhQVAVOJoS=01Za=WCwr-KUxY+iqwpKSnOZrKgkZxkVZQ@mail.gmail.com> <aojjkj79x5lmcm_Q@paquier.xyz> <CAEze2WgY-ejEcyOu5SadL5=OQdda0C-39Hs+C3fH_uQ5MTX6jQ@mail.gmail.com> <aooW8v7_96lmaR1e@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox