Index: src/bin/psql/command.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.216
diff -c -c -r1.216 command.c
*** src/bin/psql/command.c	26 Feb 2010 02:01:17 -0000	1.216
--- src/bin/psql/command.c	8 Mar 2010 00:46:10 -0000
***************
*** 1731,1740 ****
  	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;
--- 1731,1758 ----
  	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;
