Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit aa41bc7

Browse files
committed
Capitalize SHOW when testing whether target_session_attrs=read-write.
This makes it also work for replication connections. Report and patch by Daisuke Higuchi. Discussion: http://postgr.es/m/1803D792815FC24D871C00D17AE95905B1A34A@g01jpexmbkw24
1 parent b522759 commit aa41bc7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
14251425
If this parameter is set to <literal>read-write</literal>, only a
14261426
connection in which read-write transactions are accepted by default
14271427
is considered acceptable. The query
1428-
<literal>show transaction_read_only</literal> will be sent upon any
1428+
<literal>SHOW transaction_read_only</literal> will be sent upon any
14291429
successful connection; if it returns <literal>on</>, the connection
14301430
will be closed. If multiple hosts were specified in the connection
14311431
string, any remaining servers will be tried just as if the connection

src/interfaces/libpq/fe-connect.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,7 @@ PQconnectPoll(PGconn *conn)
28452845

28462846
conn->status = CONNECTION_OK;
28472847
if (!PQsendQuery(conn,
2848-
"show transaction_read_only"))
2848+
"SHOW transaction_read_only"))
28492849
{
28502850
restoreErrorMessage(conn, &savedMessage);
28512851
goto error_return;
@@ -2901,7 +2901,7 @@ PQconnectPoll(PGconn *conn)
29012901

29022902
conn->status = CONNECTION_OK;
29032903
if (!PQsendQuery(conn,
2904-
"show transaction_read_only"))
2904+
"SHOW transaction_read_only"))
29052905
{
29062906
restoreErrorMessage(conn, &savedMessage);
29072907
goto error_return;
@@ -3014,14 +3014,14 @@ PQconnectPoll(PGconn *conn)
30143014
}
30153015

30163016
/*
3017-
* Something went wrong with "show transaction_read_only". We
3017+
* Something went wrong with "SHOW transaction_read_only". We
30183018
* should try next addresses.
30193019
*/
30203020
if (res)
30213021
PQclear(res);
30223022
restoreErrorMessage(conn, &savedMessage);
30233023
appendPQExpBuffer(&conn->errorMessage,
3024-
libpq_gettext("test \"show transaction_read_only\" failed "
3024+
libpq_gettext("test \"SHOW transaction_read_only\" failed "
30253025
" on \"%s:%s\"\n"),
30263026
conn->connhost[conn->whichhost].host,
30273027
conn->connhost[conn->whichhost].port);

0 commit comments

Comments
 (0)