Re: Alternative to \copy in psql modelled after \g

Daniel Verite <daniel@manitou-mail.org>

From: "Daniel Verite" <daniel@manitou-mail.org>
To: "Fabien COELHO" <coelho@cri.ensmp.fr>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>,"Alvaro Herrera" <alvherre@2ndquadrant.com>,"PostgreSQL Hackers" <pgsql-hackers@lists.postgresql.org>,"David G. Johnston" <david.g.johnston@gmail.com>
Date: 2019-01-21T13:12:59Z
Lists: pgsql-hackers
	Fabien COELHO wrote:

> (1) document ERROR as being muddy, i.e. there has been some error which 
> may be SQL or possibly client side. Although SQLSTATE would still allow to 
> know whether an SQL error occured, there is still no client side 
> expressions, and even if I had moved pgbench expressions to psql they 
> would still need to be extended to handle strings. This suggest that maybe 
> there could be an SQL_ERROR boolean which does store whether SQL succeeded 
> or not, and possibly a CLIENT_ERROR on the side, and ERROR = SQL_ERROR OR 
> CLIENT_ERROR.
> 
> (2) keep ERROR as is, i.e. about SQL, and add some CLIENT_ERROR, but then 
> I see another issue, if it is *only* the client error, then it should be 
> true if there is an SQL error, thus checking if there is any error becomes 
> ERROR OR CLIENT_ERROR, which is muddy as well especially as there are no 
> client-side expressions in psql.

(3) Set ERROR=true if ON_ERROR_STOP would quit on the exact same
conditions.

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


Commits

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