|
3 | 3 | * |
4 | 4 | * Copyright (c) 2000-2006, PostgreSQL Global Development Group |
5 | 5 | * |
6 | | - * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.127 2006/08/29 22:25:07 tgl Exp $ |
| 6 | + * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.128 2006/08/29 22:48:55 tgl Exp $ |
7 | 7 | */ |
8 | 8 | #include"postgres_fe.h" |
9 | 9 | #include"common.h" |
@@ -1062,17 +1062,26 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) |
1062 | 1062 |
|
1063 | 1063 | /* get FETCH_COUNT tuples at a time */ |
1064 | 1064 | results=PQexec(pset.db,fetch_cmd); |
1065 | | -OK=AcceptResult(results)&& |
1066 | | -(PQresultStatus(results)==PGRES_TUPLES_OK); |
1067 | 1065 |
|
1068 | 1066 | if (pset.timing) |
1069 | 1067 | { |
1070 | 1068 | GETTIMEOFDAY(&after); |
1071 | 1069 | *elapsed_msec+=DIFF_MSEC(&after,&before); |
1072 | 1070 | } |
1073 | 1071 |
|
1074 | | -if (!OK) |
| 1072 | +if (PQresultStatus(results)!=PGRES_TUPLES_OK) |
1075 | 1073 | { |
| 1074 | +/* shut down pager before printing error message */ |
| 1075 | +if (did_pager) |
| 1076 | +{ |
| 1077 | +ClosePager(pset.queryFout); |
| 1078 | +pset.queryFout=queryFout_copy; |
| 1079 | +pset.queryFoutPipe=queryFoutPipe_copy; |
| 1080 | +did_pager= false; |
| 1081 | +} |
| 1082 | + |
| 1083 | +OK=AcceptResult(results); |
| 1084 | +psql_assert(!OK); |
1076 | 1085 | PQclear(results); |
1077 | 1086 | break; |
1078 | 1087 | } |
|