pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Subject: Re: Thread-safe stringToNode() / pg_strtok()
Date: Sun, 16 Aug 2026 16:13:20 +0900
Message-ID: <aoFjAh0H7VBmhsZX@paquier.xyz> (raw)
In-Reply-To: <CAEze2WjsGnOM4MB+n1LLdhhUg6r=hwWZRv+-heDE4UtzRdgjyg@mail.gmail.com>
References: <CAEze2WjsGnOM4MB+n1LLdhhUg6r=hwWZRv+-heDE4UtzRdgjyg@mail.gmail.com>

On Fri, Aug 14, 2026 at 04:08:24PM +0200, Matthias van de Meent wrote:
> In line with various other efforts making things more re-entrant and
> thread-safe, here's a patch that makes stringToNode (and pg_strtok
> with it) thread safe.

I have been reading the patch (not tested, just looking at the diffs),
and using a context as you are doing sounds like an acceptable thing
to do to remove the static pointer used by pg_strtok().  At least the
change makes sense here when taken in isolation.

> There are other things we could do to improve this code (e.g.
> de/serializaing based on node descriptors instead of generated
> functions), but I consider such improvements to be out of scope for
> this patch; the attached is just a simple move from global variables
> to a context struct passed down the call stack.

That sounds fair.

Any thoughts or comments from others?
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (14+ messages)  latest in thread

Message-ID: <aoFjAh0H7VBmhsZX@paquier.xyz>
Permalink:  ../aoFjAh0H7VBmhsZX@paquier.xyz/
Also on:    postgresql.org/message-id/aoFjAh0H7VBmhsZX@paquier.xyz

 · 

reply

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, hlinnaka@iki.fi
  Subject: Re: Thread-safe stringToNode() / pg_strtok()
  In-Reply-To: <aoFjAh0H7VBmhsZX@paquier.xyz>
  References: <CAEze2WjsGnOM4MB+n1LLdhhUg6r=hwWZRv+-heDE4UtzRdgjyg@mail.gmail.com> <aoFjAh0H7VBmhsZX@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