*** pgsql/src/bin/psql/command.c 2009/06/11 14:49:07 1.206 --- pgsql/src/bin/psql/command.c 2010/03/09 01:10:23 1.206.2.1 *************** *** 3,9 **** * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * ! * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.205 2009/04/21 15:49:06 momjian Exp $ */ #include "postgres_fe.h" #include "command.h" --- 3,9 ---- * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * ! * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.206 2009/06/11 14:49:07 momjian Exp $ */ #include "postgres_fe.h" #include "command.h" *************** process_file(char *filename, bool single *** 1688,1697 **** pset.inputfile = filename; if (single_txn) ! res = PSQLexec("BEGIN", false); result = MainLoop(fd); if (single_txn) ! res = PSQLexec("COMMIT", false); fclose(fd); pset.inputfile = oldfilename; --- 1688,1715 ---- pset.inputfile = filename; if (single_txn) ! { ! if ((res = PSQLexec("BEGIN", false)) == NULL) ! { ! if (pset.on_error_stop) ! return EXIT_USER; ! } ! else ! PQclear(res); ! } ! result = MainLoop(fd); + if (single_txn) ! { ! if ((res = PSQLexec("COMMIT", false)) == NULL) ! { ! if (pset.on_error_stop) ! return EXIT_USER; ! } ! else ! PQclear(res); ! } fclose(fd); pset.inputfile = oldfilename;