Thread-safe stringToNode() / pg_strtok()

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Thread-safe stringToNode() / pg_strtok()
Date: 2026-08-14 14:08:24
Message-ID: CAEze2WjsGnOM4MB+n1LLdhhUg6r=hwWZRv+-heDE4UtzRdgjyg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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.

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.

Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)

Attachment Content-Type Size
v1-0001-Make-stringToNode-infrastructure-thread-safe.patch application/octet-stream 23.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-08-14 14:15:46 Re: Support EXCEPT for TABLES IN SCHEMA publications
Previous Message Daniel Gustafsson 2026-08-14 14:07:58 Re: MERGE/SPLIT PARTITIONS issues/questions