Commit aa41bc79 authored by Robert Haas's avatar Robert Haas

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
parent b5227595
...@@ -1425,7 +1425,7 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname ...@@ -1425,7 +1425,7 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
If this parameter is set to <literal>read-write</literal>, only a If this parameter is set to <literal>read-write</literal>, only a
connection in which read-write transactions are accepted by default connection in which read-write transactions are accepted by default
is considered acceptable. The query is considered acceptable. The query
<literal>show transaction_read_only</literal> will be sent upon any <literal>SHOW transaction_read_only</literal> will be sent upon any
successful connection; if it returns <literal>on</>, the connection successful connection; if it returns <literal>on</>, the connection
will be closed. If multiple hosts were specified in the connection will be closed. If multiple hosts were specified in the connection
string, any remaining servers will be tried just as if the connection string, any remaining servers will be tried just as if the connection
......
...@@ -2845,7 +2845,7 @@ keep_going: /* We will come back to here until there is ...@@ -2845,7 +2845,7 @@ keep_going: /* We will come back to here until there is
conn->status = CONNECTION_OK; conn->status = CONNECTION_OK;
if (!PQsendQuery(conn, if (!PQsendQuery(conn,
"show transaction_read_only")) "SHOW transaction_read_only"))
{ {
restoreErrorMessage(conn, &savedMessage); restoreErrorMessage(conn, &savedMessage);
goto error_return; goto error_return;
...@@ -2901,7 +2901,7 @@ keep_going: /* We will come back to here until there is ...@@ -2901,7 +2901,7 @@ keep_going: /* We will come back to here until there is
conn->status = CONNECTION_OK; conn->status = CONNECTION_OK;
if (!PQsendQuery(conn, if (!PQsendQuery(conn,
"show transaction_read_only")) "SHOW transaction_read_only"))
{ {
restoreErrorMessage(conn, &savedMessage); restoreErrorMessage(conn, &savedMessage);
goto error_return; goto error_return;
...@@ -3014,14 +3014,14 @@ keep_going: /* We will come back to here until there is ...@@ -3014,14 +3014,14 @@ keep_going: /* We will come back to here until there is
} }
/* /*
* Something went wrong with "show transaction_read_only". We * Something went wrong with "SHOW transaction_read_only". We
* should try next addresses. * should try next addresses.
*/ */
if (res) if (res)
PQclear(res); PQclear(res);
restoreErrorMessage(conn, &savedMessage); restoreErrorMessage(conn, &savedMessage);
appendPQExpBuffer(&conn->errorMessage, appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("test \"show transaction_read_only\" failed " libpq_gettext("test \"SHOW transaction_read_only\" failed "
" on \"%s:%s\"\n"), " on \"%s:%s\"\n"),
conn->connhost[conn->whichhost].host, conn->connhost[conn->whichhost].host,
conn->connhost[conn->whichhost].port); conn->connhost[conn->whichhost].port);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment