From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | Daniel Verite <daniel(at)manitou-mail(dot)org> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Subject: | Re: Alternative to \copy in psql modelled after \g |
Date: | 2019-01-20 14:48:14 |
Message-ID: | alpine.DEB.2.21.1901201546120.28945@lancre |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>>> I understand from the code that the COPY is really executed, so the ERROR
>>> and so ROW_COUNT about the SQL should reflect that. Basically the change
>>> makes the client believe that there is an SQL error whereas the error is
>>> on the client.
>>
>> Right, but wether COPY fails because psql can't write the output,
>> possibly half-way because of a disk full condition, or because the
>> query was cancelled or the server went down, are these distinctions
>> meaningful for a script?
>
> It could if the SQL command has side effects, but probably this does not
> apply to COPY TO which cannot have.
Yes it can:
COPY (
UPDATE pgbench_branches
SET bbalance = bbalance + 1
WHERE bid <= 5
RETURNING *) TO STDOUT \g /BAD
The SQL command is executed but the backslash command fails.
--
Fabien.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2019-01-20 14:54:50 | Re: possible deadlock: different lock ordering for heap pages |
Previous Message | Tomas Vondra | 2019-01-20 14:42:35 | Re: Delay locking partitions during INSERT and UPDATE |