Re: Alternative to \copy in psql modelled after \g - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: Alternative to \copy in psql modelled after \g
Date
Msg-id 0994a8d8-9837-4824-b659-55de6f3a7bdf@manitou-mail.org
Whole thread Raw
In response to Re: Alternative to \copy in psql modelled after \g  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Alternative to \copy in psql modelled after \g  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
    David G. Johnston wrote:

> Do I understand correctly that you are proposing a slightly less
> verbose alternative of:
>
> \o :filename
> COPY TO STDOUT
> \o

Not strictly the same because of this:

\o or \out [ filename ]
....
  “Query results” includes all tables, command responses, and notices
  obtained from the database server, as well as output of various
  backslash commands that query the database (such as \d); but not
  error messages.

If for instance psql received a notification between the two \o it would
end up in the file, which it wouldn't with \copyto.
The same is true for  SELECT... \g file as opposed to \o file

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


pgsql-hackers by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: csv format for psql
Next
From: Jürgen Strobel
Date:
Subject: BUG #15212: Default values in partition tables don't work as expectedand allow NOT NULL violation