summaryrefslogtreecommitdiff
path: root/src/test/examples
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2018-07-01 14:06:40 +0200
committerPeter Eisentraut <peter_e@gmx.net>2018-07-01 14:09:22 +0200
commit2a4dca949109dae3b95c5f4d55462fd4e6673310 (patch)
tree8cc8eb2048183777186d5285e3811938735c0615 /src/test/examples
parentf61a25727cd9246d749825cdaafa821b7ddbad7c (diff)
downloadpostgresql-2a4dca949109dae3b95c5f4d55462fd4e6673310.tar.gz
Fix libpq example programs
When these programs call pg_catalog.set_config, they need to check for PGRES_TUPLES_OK instead of PGRES_COMMAND_OK. Fix for 5770172cb0c9df9e6ce27c507b449557e5b45124. Reported-by: Ideriha, Takeshi <ideriha.takeshi@jp.fujitsu.com>
Diffstat (limited to 'src/test/examples')
-rw-r--r--src/test/examples/testlibpq.c2
-rw-r--r--src/test/examples/testlibpq2.c2
-rw-r--r--src/test/examples/testlibpq4.c2
-rw-r--r--src/test/examples/testlo.c2
-rw-r--r--src/test/examples/testlo64.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/test/examples/testlibpq.c b/src/test/examples/testlibpq.c
index 92a05e5309..d9c6c4587d 100644
--- a/src/test/examples/testlibpq.c
+++ b/src/test/examples/testlibpq.c
@@ -51,7 +51,7 @@ main(int argc, char **argv)
/* Set always-secure search path, so malicous users can't take control. */
res = PQexec(conn,
"SELECT pg_catalog.set_config('search_path', '', false)");
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
+ if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "SET failed: %s", PQerrorMessage(conn));
PQclear(res);
diff --git a/src/test/examples/testlibpq2.c b/src/test/examples/testlibpq2.c
index 76787fe010..62ecd68b55 100644
--- a/src/test/examples/testlibpq2.c
+++ b/src/test/examples/testlibpq2.c
@@ -80,7 +80,7 @@ main(int argc, char **argv)
/* Set always-secure search path, so malicous users can't take control. */
res = PQexec(conn,
"SELECT pg_catalog.set_config('search_path', '', false)");
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
+ if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "SET failed: %s", PQerrorMessage(conn));
PQclear(res);
diff --git a/src/test/examples/testlibpq4.c b/src/test/examples/testlibpq4.c
index a20f6249b4..6fcbdda2fa 100644
--- a/src/test/examples/testlibpq4.c
+++ b/src/test/examples/testlibpq4.c
@@ -37,7 +37,7 @@ check_prepare_conn(PGconn *conn, const char *dbName)
/* Set always-secure search path, so malicous users can't take control. */
res = PQexec(conn,
"SELECT pg_catalog.set_config('search_path', '', false)");
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
+ if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "SET failed: %s", PQerrorMessage(conn));
PQclear(res);
diff --git a/src/test/examples/testlo.c b/src/test/examples/testlo.c
index bd6a397f86..dae68dcade 100644
--- a/src/test/examples/testlo.c
+++ b/src/test/examples/testlo.c
@@ -235,7 +235,7 @@ main(int argc, char **argv)
/* Set always-secure search path, so malicous users can't take control. */
res = PQexec(conn,
"SELECT pg_catalog.set_config('search_path', '', false)");
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
+ if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "SET failed: %s", PQerrorMessage(conn));
PQclear(res);
diff --git a/src/test/examples/testlo64.c b/src/test/examples/testlo64.c
index 0ee13b280b..19d9cba473 100644
--- a/src/test/examples/testlo64.c
+++ b/src/test/examples/testlo64.c
@@ -259,7 +259,7 @@ main(int argc, char **argv)
/* Set always-secure search path, so malicous users can't take control. */
res = PQexec(conn,
"SELECT pg_catalog.set_config('search_path', '', false)");
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
+ if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "SET failed: %s", PQerrorMessage(conn));
PQclear(res);