PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

il comando \copy gestisce il commit e il rollback in postgres?

Se \copy la transazione non riuscita verrà interrotta, ecco un esempio:

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