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

Commit138531f

Browse files
committed
Clear conn->errorMessage at successful completion of PQconnectdb().
Commitsffa2e46 and52a1022 caused libpq's connection-establishmentfunctions to usually leave a nonempty string in the connection'serrorMessage buffer, even after a successful connection. While thatwas intentional on my part, more sober reflection says that it wasn'ta great idea: the string would be a bit confusing. Also this broke atleast one application that checked for connection success by examiningthe errorMessage, instead of using PQstatus() as documented. Let'sclear the buffer at success exit, restoring the pre-v14 behavior.Discussion:https://postgr.es/m/4170264.1620321747@sss.pgh.pa.us
1 parent1882d6c commit138531f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3654,6 +3654,13 @@ PQconnectPoll(PGconn *conn)
36543654
/* We can release the address list now. */
36553655
release_conn_addrinfo(conn);
36563656

3657+
/*
3658+
* Contents of conn->errorMessage are no longer interesting
3659+
* (and it seems some clients expect it to be empty after a
3660+
* successful connection).
3661+
*/
3662+
resetPQExpBuffer(&conn->errorMessage);
3663+
36573664
/* We are open for business! */
36583665
conn->status=CONNECTION_OK;
36593666
returnPGRES_POLLING_OK;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp