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/[email protected] Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cda1e27fb7064e499ea499776bad13036d9c4961 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(-)
