pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor CopyAttributeOut{CSV,Text}() to use a callback in COPY
Date: Mon, 05 Feb 2024 02:12:51 +0000
Message-ID: <E1rWoTb-004iAg-Vi@gemulon.postgresql.org> (raw)

Refactor CopyAttributeOut{CSV,Text}() to use a callback in COPY TO

These routines are used by the text and CSV formats to send an output
representation of a string, applying quotes if required.  This is
similar to 95fb5b49024a, reducing the number of "if" branches that need
to be checked on a per-row basis when sending representation of fields
in text or CSV mode.

While on it, this simplifies the signature of CopyAttributeOutCSV() as
it is possible to know that an attribute is alone on a line thanks to
CopyToState.  Headers should not use quotes, even if forced at query
level.

Extracted from a larger patch by the same author.

Author: Sutou Kouhei
Discussion: https://postgr.es/m/20231204.153548.2126325458835528809.kou@clear-code.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2889fd23be565155c8cd96a8c5a07ac971261515

Modified Files
--------------
src/backend/commands/copyto.c | 47 +++++++++++++++++++++++++++++--------------
1 file changed, 32 insertions(+), 15 deletions(-)



Message-ID: <E1rWoTb-004iAg-Vi@gemulon.postgresql.org>
Permalink:  ../E1rWoTb-004iAg-Vi@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rWoTb-004iAg-Vi@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor CopyAttributeOut{CSV,Text}() to use a callback in COPY
  In-Reply-To: <E1rWoTb-004iAg-Vi@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