PostgreSQL
 sql >> Base de Dados >  >> RDS >> PostgreSQL

o comando \copy lida com commit e rollback no postgres?


Se \copy falha na transação será abortada, aqui está o exemplo:
t=# \! cat s07
create table trans(i int);
copy s07 from '/no such file';
t=# begin;
BEGIN
t=# \i s07
CREATE TABLE
psql:s07:2: ERROR:  could not open file "/no such file" for reading: No such file or directory
t=# select * from trans;
ERROR:  current transaction is aborted, commands ignored until end of transaction block
t=# end;
ROLLBACK