pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix psql's "\g target" meta-command to work with COPY TO STDOUT.
Date: Sat, 26 Jan 2019 19:15:59 +0000
Message-ID: <E1gnTQt-0007lh-Gp@gemulon.postgresql.org> (raw)

Fix psql's "\g target" meta-command to work with COPY TO STDOUT.

Previously, \g would successfully execute the COPY command, but
the target specification if any was ignored, so that the data was
always dumped to the regular query output target.  This seems like
a clear bug, so let's not just fix it but back-patch it.

While at it, adjust the documentation for \copy to recommend
"COPY ... TO STDOUT \g foo" as a plausible alternative.

Back-patch to 9.5.  The problem exists much further back, but the
code associated with \g was refactored enough in 9.5 that we'd
need a significantly different patch for 9.4, and it doesn't
seem worth the trouble.

Daniel Vérité, reviewed by Fabien Coelho

Discussion: https://postgr.es/m/15dadc39-e050-4d46-956b-dcc4ed098753@manitou-mail.org

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8e97a97b3206c18d155a925349b5f57052912509

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 22 +++++++++++++---
src/bin/psql/common.c          | 57 ++++++++++++++++++++++++++++++++++++------
src/bin/psql/copy.c            |  7 ++++--
3 files changed, 73 insertions(+), 13 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1gnTQt-0007lh-Gp@gemulon.postgresql.org>
Permalink:  ../E1gnTQt-0007lh-Gp@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gnTQt-0007lh-Gp@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix psql's "\g target" meta-command to work with COPY TO STDOUT.
  In-Reply-To: <E1gnTQt-0007lh-Gp@gemulon.postgresql.org>
  References: <E1gnTQt-0007lh-Gp@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