Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21e0b7b

Browse files
committed
Get rid of extraneous newline in PQendcopy error output (was causing
regression test diffs...).
1 parentefc3a25 commit21e0b7b

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

‎src/interfaces/libpq/fe-protocol2.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.2 2003/06/2121:51:34 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.3 2003/06/2123:25:38 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1183,15 +1183,30 @@ pqEndcopy2(PGconn *conn)
11831183
}
11841184

11851185
/*
1186-
* Trouble. The worst case is that we've lost sync with the backend
1187-
* entirely due to application screwup of the copy in/out protocol. To
1188-
* recover, reset the connection (talk about using a sledgehammer...)
1186+
* Trouble. For backwards-compatibility reasons, we issue the error
1187+
* message as if it were a notice (would be nice to get rid of this
1188+
* silliness, but too many apps probably don't handle errors from
1189+
* PQendcopy reasonably). Note that the app can still obtain the
1190+
* error status from the PGconn object.
11891191
*/
1190-
PQclear(result);
1191-
11921192
if (conn->errorMessage.len>0)
1193+
{
1194+
/* We have to strip the trailing newline ... pain in neck... */
1195+
charsvLast=conn->errorMessage.data[conn->errorMessage.len-1];
1196+
1197+
if (svLast=='\n')
1198+
conn->errorMessage.data[conn->errorMessage.len-1]='\0';
11931199
PGDONOTICE(conn,conn->errorMessage.data);
1200+
conn->errorMessage.data[conn->errorMessage.len-1]=svLast;
1201+
}
11941202

1203+
PQclear(result);
1204+
1205+
/*
1206+
* The worst case is that we've lost sync with the backend
1207+
* entirely due to application screwup of the copy in/out protocol. To
1208+
* recover, reset the connection (talk about using a sledgehammer...)
1209+
*/
11951210
PGDONOTICE(conn,libpq_gettext("lost synchronization with server, resetting connection"));
11961211

11971212
/*

‎src/interfaces/libpq/fe-protocol3.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.2 2003/06/2121:51:34 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.3 2003/06/2123:25:38 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1113,7 +1113,15 @@ pqEndcopy3(PGconn *conn)
11131113
* error status from the PGconn object.
11141114
*/
11151115
if (conn->errorMessage.len>0)
1116+
{
1117+
/* We have to strip the trailing newline ... pain in neck... */
1118+
charsvLast=conn->errorMessage.data[conn->errorMessage.len-1];
1119+
1120+
if (svLast=='\n')
1121+
conn->errorMessage.data[conn->errorMessage.len-1]='\0';
11161122
PGDONOTICE(conn,conn->errorMessage.data);
1123+
conn->errorMessage.data[conn->errorMessage.len-1]=svLast;
1124+
}
11171125

11181126
PQclear(result);
11191127

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp