pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid unnecessary allocation for tablesync.c COPY buffer
Date: Tue, 24 Nov 2026 20:38:33 +0000
Message-ID: <E1xVxHc-00000000B5L-3gj4@gemulon.postgresql.org> (raw)

Avoid unnecessary allocation for tablesync.c COPY buffer

copybuf serves only as a read-only parse buffer and is never
appended-to, enlarged or reset.  Previously it was a file-level static
StringInfoData, allocated via makeStringInfo(), but that was abusing the
StringInfo interface.

A function-level static read-only StringInfo, as introduced by commit
f0efa5aec193, works just as well, and is less notionally bogus.

There are no functional changes here: unconsumed leftover bytes are
still consumed in the next call to this function, just like in the
previous coding.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Denis Smirnov <darthunix@gmail.com>
Reviewed-by: ZizhuanLiu (X-MAN) <44973863@qq.com>
Commitfest: https://commitfest.postgresql.org/patch/6757/
Discussion: https://postgr.es/m/5B2C9B4C-EAE6-4F21-AF99-613A561D26DC@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7720f61b7d6f5b1f702ecc1d46dd87d25808a785

Modified Files
--------------
src/backend/replication/logical/tablesync.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)



Message-ID: <E1xVxHc-00000000B5L-3gj4@gemulon.postgresql.org>
Permalink:  ../E1xVxHc-00000000B5L-3gj4@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xVxHc-00000000B5L-3gj4@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: alvherre@kurilemu.de
  Subject: Re: pgsql: Avoid unnecessary allocation for tablesync.c COPY buffer
  In-Reply-To: <E1xVxHc-00000000B5L-3gj4@gemulon.postgresql.org>
  References: <E1xVxHc-00000000B5L-3gj4@gemulon.postgresql.org>

* 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