21#include "catalog/pg_type_d.h"
32static const
char *const
progname = "libpq_pipeline";
39#define pg_debug(...) do { fprintf(stderr, __VA_ARGS__); } while (0)
45"DROP TABLE IF EXISTS pq_pipeline_demo";
47"CREATE UNLOGGED TABLE pq_pipeline_demo(id serial primary key, itemno integer,"
50"INSERT INTO pq_pipeline_demo(itemno) VALUES ($1)";
52"INSERT INTO pq_pipeline_demo(itemno,int8filler) VALUES ($1, $2)";
73#define pg_fatal(...) pg_fatal_impl(__LINE__, __VA_ARGS__)
85 Assert(fmt[strlen(fmt) - 1] !=
'\n');
93#define confirm_query_canceled(conn) confirm_query_canceled_impl(__LINE__, conn)
104 pg_fatal_impl(line,
"query did not fail when it was expected");
106 pg_fatal_impl(line,
"query failed with a different error than cancellation: %s",
121 char *
state,
char *event)
123 const Oid paramTypes[] = {INT4OID, TEXTOID};
124 const char *paramValues[2];
125 char *pidstr =
psprintf(
"%d", procpid);
129 paramValues[0] = pidstr;
139 "SELECT count(*) FROM pg_stat_activity WHERE "
140 "pid = $1 AND state = $2",
141 2, paramTypes, paramValues, NULL, NULL, 0);
144 "SELECT count(*) FROM pg_stat_activity WHERE "
145 "pid = $1 AND wait_event = $2",
146 2, paramTypes, paramValues, NULL, NULL, 0);
155 if (strcmp(
value,
"0") != 0)
169#define send_cancellable_query(conn, monitorConn) \
170 send_cancellable_query_impl(__LINE__, conn, monitorConn)
174 const char *env_wait;
175 const Oid paramTypes[1] = {INT4OID};
184 env_wait = getenv(
"PG_TEST_TIMEOUT_DEFAULT");
185 if (env_wait == NULL)
189 &env_wait, NULL, NULL, 0) != 1)
217 vals =
pg_malloc(
sizeof(
char *) * nopts);
234 pg_fatal(
"Connection to database failed: %s",
251 fprintf(stderr,
"test cancellations... ");
266 if (!
PQcancel(cancel, errorbuf,
sizeof(errorbuf)))
267 pg_fatal(
"failed to run PQcancel: %s", errorbuf);
272 if (!
PQcancel(cancel, errorbuf,
sizeof(errorbuf)))
273 pg_fatal(
"failed to run PQcancel: %s", errorbuf);
308 FD_ZERO(&input_mask);
309 FD_ZERO(&output_mask);
314 FD_SET(sock, &input_mask);
318 FD_SET(sock, &output_mask);
332 if (
select(sock + 1, &input_mask, &output_mask, NULL, &tv) < 0)
365 FD_ZERO(&input_mask);
366 FD_ZERO(&output_mask);
371 FD_SET(sock, &input_mask);
375 FD_SET(sock, &output_mask);
389 if (
select(sock + 1, &input_mask, &output_mask, NULL, &tv) < 0)
412 fprintf(stderr,
"test error cases... ");
415 pg_fatal(
"Expected blocking connection mode");
418 pg_fatal(
"Unable to enter pipeline mode");
421 pg_fatal(
"Pipeline mode not activated properly");
426 pg_fatal(
"PQexec should fail in pipeline mode but succeeded");
428 "synchronous command execution functions are not allowed in pipeline mode\n") != 0)
429 pg_fatal(
"did not get expected error message; got: \"%s\"",
434 pg_fatal(
"PQsendQuery should fail in pipeline mode but succeeded");
436 "PQsendQuery not allowed in pipeline mode\n") != 0)
437 pg_fatal(
"did not get expected error message; got: \"%s\"",
442 pg_fatal(
"re-entering pipeline mode should be a no-op but failed");
445 pg_fatal(
"PQisBusy should return 0 when idle in pipeline mode, returned 1");
449 pg_fatal(
"couldn't exit idle empty pipeline mode");
452 pg_fatal(
"Pipeline mode not terminated properly");
456 pg_fatal(
"pipeline mode exit when not in pipeline mode should succeed but failed");
461 pg_fatal(
"PQexec should succeed after exiting pipeline mode but failed with: %s",
471 const char *dummy_params[1] = {
"1"};
472 Oid dummy_param_oids[1] = {INT4OID};
474 fprintf(stderr,
"multi pipeline... ");
485 dummy_params, NULL, NULL, 0) != 1)
493 dummy_params, NULL, NULL, 0) != 1)
502 dummy_params, NULL, NULL, 0) != 1)
514 pg_fatal(
"PQgetResult returned null when there's a pipeline item: %s",
518 pg_fatal(
"Unexpected result code %s from first pipeline item",
524 pg_fatal(
"PQgetResult returned something extra after first result");
527 pg_fatal(
"exiting pipeline mode after query but before sync succeeded incorrectly");
531 pg_fatal(
"PQgetResult returned null when sync result expected: %s",
535 pg_fatal(
"Unexpected result code %s instead of sync result, error: %s",
543 pg_fatal(
"PQgetResult returned null when there's a pipeline item: %s",
547 pg_fatal(
"Unexpected result code %s from second pipeline item",
553 pg_fatal(
"PQgetResult returned something extra after first result");
556 pg_fatal(
"exiting pipeline mode after query but before sync succeeded incorrectly");
560 pg_fatal(
"PQgetResult returned null when sync result expected: %s",
564 pg_fatal(
"Unexpected result code %s instead of sync result, error: %s",
572 pg_fatal(
"PQgetResult returned null when there's a pipeline item: %s",
576 pg_fatal(
"Unexpected result code %s from third pipeline item",
581 pg_fatal(
"Expected null result, got %s",
586 pg_fatal(
"PQgetResult returned null when there's a pipeline item: %s",
590 pg_fatal(
"Unexpected result code %s from second pipeline sync",
595 pg_fatal(
"Fell out of pipeline mode somehow");
599 pg_fatal(
"attempt to exit pipeline mode failed when it should've succeeded: %s",
603 pg_fatal(
"exiting pipeline mode didn't seem to work");
625 pg_fatal(
"could not enter pipeline mode");
626 for (
int i = 0;
i < numqueries;
i++)
632 0, NULL, NULL, NULL, NULL, 0) != 1)
639 FD_ZERO(&input_mask);
640 FD_SET(sock, &input_mask);
643 if (
select(sock + 1, &input_mask, NULL, NULL, &tv) < 0)
645 fprintf(stderr,
"select() failed: %m\n");
654 pg_fatal(
"failed to send flush request");
666 pg_fatal(
"got unexpected NULL result after %d results", results);
682 if (results == numqueries)
708 const char *dummy_params[1] = {
"1"};
709 Oid dummy_param_oids[1] = {INT4OID};
714 fprintf(stderr,
"aborted pipeline... ");
732 dummy_params[0] =
"1";
734 dummy_params, NULL, NULL, 0) != 1)
738 1, dummy_param_oids, dummy_params,
742 dummy_params[0] =
"2";
744 dummy_params, NULL, NULL, 0) != 1)
750 dummy_params[0] =
"3";
752 dummy_params, NULL, NULL, 0) != 1)
753 pg_fatal(
"dispatching second-pipeline insert failed: %s",
770 pg_fatal(
"Unexpected result status %s: %s",
777 pg_fatal(
"Expected null result, got %s",
785 pg_fatal(
"Unexpected result code -- expected PGRES_FATAL_ERROR, got %s",
791 pg_fatal(
"Expected null result, got %s",
802 pg_fatal(
"pipeline should be flagged as aborted but isn't");
809 pg_fatal(
"Unexpected result code -- expected PGRES_PIPELINE_ABORTED, got %s",
818 pg_fatal(
"pipeline should be flagged as aborted but isn't");
822 pg_fatal(
"Fell out of pipeline mode somehow");
834 pg_fatal(
"Unexpected result code from first pipeline sync\n"
835 "Expected PGRES_PIPELINE_SYNC, got %s",
840 pg_fatal(
"sync should've cleared the aborted flag but didn't");
844 pg_fatal(
"Fell out of pipeline mode somehow");
851 pg_fatal(
"Unexpected result code %s from first item in second pipeline",
863 pg_fatal(
"Unexpected result code %s from second pipeline sync",
868 pg_fatal(
"Expected null result, got %s: %s",
884 pg_fatal(
"expected error about multiple commands, got %s",
895 pg_fatal(
"did not get cannot-insert-multiple-commands error");
900 pg_fatal(
"Unexpected result code %s from pipeline sync",
906 0, NULL, NULL, NULL, NULL, 0) != 1)
923 pg_fatal(
"expected division-by-zero, got: %s (%s)",
926 printf(
"got expected division-by-zero\n");
935 pg_fatal(
"did not get division-by-zero error");
942 pg_fatal(
"Unexpected result code %s from third pipeline sync",
948 pg_fatal(
"Fell out of pipeline mode somehow");
952 pg_fatal(
"attempt to exit pipeline mode failed when it should've succeeded: %s",
956 pg_fatal(
"exiting pipeline mode didn't seem to work");
973 res =
PQexec(
conn,
"SELECT itemno FROM pq_pipeline_demo");
976 pg_fatal(
"Expected tuples, got %s: %s",
984 if (strcmp(
val,
"3") != 0)
985 pg_fatal(
"expected only insert with value 3, got %s",
val);
1009 Oid insert_param_oids[2] = {INT4OID, INT8OID};
1010 const char *insert_params[2];
1018 insert_params[0] = insert_param_0;
1019 insert_params[1] = insert_param_1;
1021 rows_to_send = rows_to_receive = n_rows;
1036 sql =
"BEGIN TRANSACTION";
1057 0, NULL, NULL, NULL, NULL, 0) != 1)
1089 FD_ZERO(&input_mask);
1090 FD_SET(sock, &input_mask);
1091 FD_ZERO(&output_mask);
1092 FD_SET(sock, &output_mask);
1094 if (
select(sock + 1, &input_mask, &output_mask, NULL, NULL) < 0)
1096 fprintf(stderr,
"select() failed: %m\n");
1104 if (FD_ISSET(sock, &input_mask))
1112 const char *cmdtag =
"";
1132 cmdtag =
"DROP TABLE";
1136 cmdtag =
"CREATE TABLE";
1147 if (rows_to_receive == 0)
1166 pg_fatal(
"%s reported status %s, expected %s\n"
1167 "Error message: \"%s\"",
1171 if (strncmp(
PQcmdStatus(res), cmdtag, strlen(cmdtag)) != 0)
1172 pg_fatal(
"%s expected command tag '%s', got '%s'",
1182 if (FD_ISSET(sock, &output_mask))
1193 2, insert_params, NULL, NULL, 0) == 1)
1195 pg_debug(
"sent row %d\n", rows_to_send);
1198 if (rows_to_send == 0)
1207 fprintf(stderr,
"WARNING: failed to send insert #%d: %s\n",
1214 0, NULL, NULL, NULL, NULL, 0) == 1)
1221 fprintf(stderr,
"WARNING: failed to send commit: %s\n",
1225 else if (send_step ==
BI_SYNC)
1234 fprintf(stderr,
"WARNING: pipeline sync failed: %s\n",
1243 pg_fatal(
"attempt to exit pipeline mode failed when it should've succeeded: %s",
1256 Oid param_oids[1] = {INT4OID};
1257 Oid expected_oids[4];
1260 fprintf(stderr,
"prepared... ");
1266 1, param_oids) != 1)
1268 expected_oids[0] = INT4OID;
1269 expected_oids[1] = TEXTOID;
1270 expected_oids[2] = NUMERICOID;
1271 expected_oids[3] = INTERVALOID;
1279 pg_fatal(
"PQgetResult returned null");
1289 pg_fatal(
"PQgetResult returned NULL");
1293 pg_fatal(
"expected %zu columns, got %d",
1298 if (typ != expected_oids[
i])
1299 pg_fatal(
"field %d: expected type %u, got %u",
1300 i, expected_oids[
i], typ);
1311 fprintf(stderr,
"closing statement..");
1319 pg_fatal(
"expected non-NULL result");
1346 fprintf(stderr,
"creating portal... ");
1348 PQexec(
conn,
"DECLARE cursor_one CURSOR FOR SELECT 1");
1356 pg_fatal(
"PQgetResult returned null");
1362 pg_fatal(
"portal: expected type %u, got %u",
1372 fprintf(stderr,
"closing portal... ");
1380 pg_fatal(
"expected non-NULL result");
1420 int protocol_version;
1421 int max_protocol_version_index;
1448 max_protocol_version_index =
i;
1456 vals[max_protocol_version_index] =
"3.0";
1460 pg_fatal(
"Connection to database failed: %s",
1464 if (protocol_version != 30000)
1465 pg_fatal(
"expected 30000, got %d", protocol_version);
1473 vals[max_protocol_version_index] =
"3.1";
1477 pg_fatal(
"Connecting with max_protocol_version 3.1 should have failed.");
1484 vals[max_protocol_version_index] =
"3.2";
1488 pg_fatal(
"Connection to database failed: %s",
1492 if (protocol_version != 30002)
1493 pg_fatal(
"expected 30002, got %d", protocol_version);
1500 vals[max_protocol_version_index] =
"latest";
1504 pg_fatal(
"Connection to database failed: %s",
1508 if (protocol_version != 30002)
1509 pg_fatal(
"expected 30002, got %d", protocol_version);
1518 int *n_notices = (
int *)
arg;
1521 fprintf(stderr,
"NOTICE %d: %s", *n_notices, message);
1531 fprintf(stderr,
"\npipeline idle...\n");
1543 pg_fatal(
"PQgetResult returned null when there's a pipeline item: %s",
1546 pg_fatal(
"unexpected result code %s from first pipeline item",
1551 pg_fatal(
"did not receive terminating NULL");
1555 pg_fatal(
"exiting pipeline succeeded when it shouldn't");
1557 strlen(
"cannot exit pipeline mode")) != 0)
1558 pg_fatal(
"did not get expected error; got: %s",
1563 pg_fatal(
"unexpected result code %s from second pipeline item",
1568 pg_fatal(
"did not receive terminating NULL");
1573 pg_fatal(
"got %d notice(s)", n_notices);
1579 if (
PQsendQueryParams(
conn,
"SELECT pg_catalog.pg_advisory_unlock(1,1)", 0, NULL, NULL, NULL, NULL, 0) != 1)
1584 pg_fatal(
"unexpected NULL result received");
1596 const char *dummy_params[1] = {
"1"};
1597 Oid dummy_param_oids[1] = {INT4OID};
1599 fprintf(stderr,
"simple pipeline... ");
1610 pg_fatal(
"Expected blocking connection mode");
1616 1, dummy_param_oids, dummy_params,
1617 NULL, NULL, 0) != 1)
1621 pg_fatal(
"exiting pipeline mode with work in progress should fail, but succeeded");
1628 pg_fatal(
"PQgetResult returned null when there's a pipeline item: %s",
1632 pg_fatal(
"Unexpected result code %s from first pipeline item",
1639 pg_fatal(
"PQgetResult returned something extra after first query result.");
1646 pg_fatal(
"exiting pipeline mode after query but before sync succeeded incorrectly");
1650 pg_fatal(
"PQgetResult returned null when sync result PGRES_PIPELINE_SYNC expected: %s",
1654 pg_fatal(
"Unexpected result code %s instead of PGRES_PIPELINE_SYNC, error: %s",
1661 pg_fatal(
"PQgetResult returned something extra after pipeline end: %s",
1666 pg_fatal(
"Fell out of pipeline mode somehow");
1670 pg_fatal(
"attempt to exit pipeline mode failed when it should've succeeded: %s",
1674 pg_fatal(
"Exiting pipeline mode didn't seem to work");
1684 bool pipeline_ended =
false;
1687 pg_fatal(
"failed to enter pipeline mode: %s",
1691 for (
i = 0;
i < 3;
i++)
1698 "SELECT generate_series(42, $1)",
1701 (
const char **) param,
1705 pg_fatal(
"failed to send query: %s",
1712 for (
i = 0; !pipeline_ended;
i++)
1715 bool saw_ending_tuplesok;
1716 bool isSingleTuple =
false;
1722 pg_fatal(
"PQsetSingleRowMode() failed for i=%d",
i);
1726 saw_ending_tuplesok =
false;
1733 fprintf(stderr,
"end of pipeline reached\n");
1734 pipeline_ended =
true;
1737 pg_fatal(
"Expected three results, got %d",
i);
1745 pg_fatal(
"Expected PGRES_SINGLE_TUPLE for query %d, got %s",
1748 pg_fatal(
"Expected PGRES_TUPLES_OK for query %d, got %s",
1758 saw_ending_tuplesok =
true;
1762 fprintf(stderr,
"all tuples received in query %d\n",
i);
1764 pg_fatal(
"Expected to follow PGRES_SINGLE_TUPLE, but received PGRES_TUPLES_OK directly instead");
1769 isSingleTuple =
true;
1778 if (!pipeline_ended && !saw_ending_tuplesok)
1779 pg_fatal(
"didn't get expected terminating TUPLES_OK");
1788 0, NULL, NULL, NULL, NULL, 0) != 1)
1789 pg_fatal(
"failed to send query: %s",
1792 pg_fatal(
"failed to send flush request");
1794 pg_fatal(
"PQsetSingleRowMode() failed");
1799 pg_fatal(
"Expected PGRES_SINGLE_TUPLE, got %s",
1805 pg_fatal(
"Expected PGRES_TUPLES_OK, got %s",
1811 0, NULL, NULL, NULL, NULL, 0) != 1)
1812 pg_fatal(
"failed to send query: %s",
1815 pg_fatal(
"failed to send flush request");
1820 pg_fatal(
"Expected PGRES_TUPLES_OK, got %s",
1830 0, NULL, NULL, NULL, NULL, 0) != 1)
1831 pg_fatal(
"failed to send query: %s",
1834 pg_fatal(
"failed to send flush request");
1836 pg_fatal(
"PQsetChunkedRowsMode() failed");
1841 pg_fatal(
"Expected PGRES_TUPLES_CHUNK, got %s: %s",
1850 pg_fatal(
"Expected PGRES_TUPLES_CHUNK, got %s",
1858 pg_fatal(
"Expected PGRES_TUPLES_OK, got %s",
1882 res =
PQexec(
conn,
"DROP TABLE IF EXISTS pq_pipeline_tst;"
1883 "CREATE TABLE pq_pipeline_tst (id int)");
1885 pg_fatal(
"failed to create test table: %s",
1890 pg_fatal(
"failed to enter pipeline mode: %s",
1893 pg_fatal(
"could not send prepare on pipeline: %s",
1898 0, NULL, NULL, NULL, NULL, 0) != 1)
1899 pg_fatal(
"failed to send query: %s",
1903 0, NULL, NULL, NULL, NULL, 0) != 1)
1904 pg_fatal(
"failed to send query: %s",
1912 pg_fatal(
"failed to execute prepared: %s",
1917 "INSERT INTO pq_pipeline_tst VALUES (1)",
1918 0, NULL, NULL, NULL, NULL, 0) != 1)
1919 pg_fatal(
"failed to send query: %s",
1930 "INSERT INTO pq_pipeline_tst VALUES (2)",
1931 0, NULL, NULL, NULL, NULL, 0) != 1)
1932 pg_fatal(
"failed to send query: %s",
1943 pg_fatal(
"failed to execute prepared: %s",
1951 "INSERT INTO pq_pipeline_tst VALUES (3)",
1952 0, NULL, NULL, NULL, NULL, 0) != 1)
1953 pg_fatal(
"failed to send query: %s",
1963 expect_null =
false;
1964 for (
int i = 0;;
i++)
1971 printf(
"%d: got NULL result\n",
i);
1973 pg_fatal(
"did not expect NULL here");
1974 expect_null =
false;
1985 printf(
": command didn't run because pipeline aborted\n");
1999 pg_fatal(
"returned something extra after all the syncs: %s",
2006 res =
PQexec(
conn,
"SELECT * FROM pq_pipeline_tst");
2012 pg_fatal(
"did not get expected tuple");
2028 Oid paramTypes[2] = {INT8OID, INT8OID};
2029 const char *paramValues[2];
2035 bool read_done =
false;
2036 bool write_done =
false;
2037 bool error_sent =
false;
2038 bool got_error =
false;
2044 fprintf(stderr,
"uniqviol ...");
2048 paramValues[0] = paramValue0;
2049 paramValues[1] = paramValue1;
2052 res =
PQexec(
conn,
"drop table if exists ppln_uniqviol;"
2053 "create table ppln_uniqviol(id bigint primary key, idata bigint)");
2062 "insert into ppln_uniqviol values ($1, $2) returning id",
2068 pg_fatal(
"failed to enter pipeline mode");
2083 if (results >= numsent)
2092 if (new_error && got_error)
2094 got_error |= new_error;
2095 if (results++ >= numsent - 1)
2107 FD_SET(sock, &out_fds);
2110 FD_SET(sock, &in_fds);
2112 if (
select(sock + 1, &in_fds, write_done ? NULL : &out_fds, NULL, NULL) == -1)
2126 if (!write_done && FD_ISSET(sock, &out_fds))
2136 if (switched >= 1 && !error_sent && ctr % socketful >= socketful / 2)
2138 sprintf(paramValue0,
"%d", numsent / 2);
2145 sprintf(paramValue0,
"%d", ctr++);
2153 if (socketful != 0 && numsent % socketful == 42 && error_sent)
2156 pg_fatal(
"failed to send flush request");
2158 fprintf(stderr,
"\ndone writing\n");
2170 socketful = numsent;
2171 fprintf(stderr,
"\nswitch to reading\n");
2180 pg_fatal(
"did not get expected error");
2195 bool got_error =
false;
2224 fprintf(stderr,
"result %d/%d: pipeline aborted\n", results, numsent);
2246 fprintf(stderr,
"\nOptions:\n");
2247 fprintf(stderr,
" -t TRACEFILE generate a libpq trace to TRACEFILE\n");
2248 fprintf(stderr,
" -r NUMROWS use NUMROWS as the test size\n");
2255 printf(
"disallowed_in_pipeline\n");
2256 printf(
"multi_pipelines\n");
2258 printf(
"pipeline_abort\n");
2259 printf(
"pipeline_idle\n");
2260 printf(
"pipelined_insert\n");
2262 printf(
"protocol_version\n");
2263 printf(
"simple_pipeline\n");
2272 const char *conninfo =
"";
2276 int numrows = 10000;
2280 while ((
c =
getopt(argc, argv,
"r:t:")) != -1)
2286 numrows = strtol(
optarg, NULL, 10);
2287 if (errno != 0 || numrows <= 0)
2289 fprintf(stderr,
"couldn't parse \"%s\" as a positive integer\n",
2311 if (strcmp(testname,
"tests") == 0)
2327 fprintf(stderr,
"Connection to database failed: %s\n",
2332 res =
PQexec(
conn,
"SET lc_messages TO \"C\"");
2335 res =
PQexec(
conn,
"SET debug_parallel_query = off");
2357 if (strcmp(testname,
"cancel") == 0)
2359 else if (strcmp(testname,
"disallowed_in_pipeline") == 0)
2361 else if (strcmp(testname,
"multi_pipelines") == 0)
2363 else if (strcmp(testname,
"nosync") == 0)
2365 else if (strcmp(testname,
"pipeline_abort") == 0)
2367 else if (strcmp(testname,
"pipeline_idle") == 0)
2369 else if (strcmp(testname,
"pipelined_insert") == 0)
2371 else if (strcmp(testname,
"prepared") == 0)
2373 else if (strcmp(testname,
"protocol_version") == 0)
2375 else if (strcmp(testname,
"simple_pipeline") == 0)
2377 else if (strcmp(testname,
"singlerow") == 0)
2379 else if (strcmp(testname,
"transaction") == 0)
2381 else if (strcmp(testname,
"uniqviol") == 0)
2385 fprintf(stderr,
"\"%s\" is not a recognized test name\n", testname);
#define pg_attribute_printf(f, a)
static PGcancel *volatile cancelConn
#define fprintf(file, fmt, msg)
PGcancel * PQgetCancel(PGconn *conn)
void PQcancelReset(PGcancelConn *cancelConn)
PGcancelConn * PQcancelCreate(PGconn *conn)
ConnStatusType PQcancelStatus(const PGcancelConn *cancelConn)
int PQcancelBlocking(PGcancelConn *cancelConn)
int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
PostgresPollingStatusType PQcancelPoll(PGcancelConn *cancelConn)
void PQcancelFinish(PGcancelConn *cancelConn)
int PQrequestCancel(PGconn *conn)
void PQfreeCancel(PGcancel *cancel)
int PQcancelSocket(const PGcancelConn *cancelConn)
char * PQcancelErrorMessage(const PGcancelConn *cancelConn)
int PQcancelStart(PGcancelConn *cancelConn)
int PQfullProtocolVersion(const PGconn *conn)
PGconn * PQconnectdb(const char *conninfo)
PQconninfoOption * PQconninfo(PGconn *conn)
ConnStatusType PQstatus(const PGconn *conn)
void PQfinish(PGconn *conn)
int PQbackendPID(const PGconn *conn)
PGpipelineStatus PQpipelineStatus(const PGconn *conn)
PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg)
char * PQerrorMessage(const PGconn *conn)
int PQsocket(const PGconn *conn)
PGconn * PQconnectdbParams(const char *const *keywords, const char *const *values, int expand_dbname)
int PQsendQueryParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
int PQsetSingleRowMode(PGconn *conn)
int PQflush(PGconn *conn)
Oid PQftype(const PGresult *res, int field_num)
PGresult * PQdescribePrepared(PGconn *conn, const char *stmt)
PGresult * PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
int PQexitPipelineMode(PGconn *conn)
int PQsendClosePortal(PGconn *conn, const char *portal)
int PQenterPipelineMode(PGconn *conn)
PGresult * PQclosePrepared(PGconn *conn, const char *stmt)
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
PGresult * PQclosePortal(PGconn *conn, const char *portal)
PGresult * PQgetResult(PGconn *conn)
ExecStatusType PQresultStatus(const PGresult *res)
void PQclear(PGresult *res)
int PQsendClosePrepared(PGconn *conn, const char *stmt)
int PQsendPipelineSync(PGconn *conn)
int PQntuples(const PGresult *res)
PGresult * PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
char * PQresultErrorMessage(const PGresult *res)
int PQsendDescribePrepared(PGconn *conn, const char *stmt)
int PQconsumeInput(PGconn *conn)
int PQsetnonblocking(PGconn *conn, int arg)
int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
PGresult * PQdescribePortal(PGconn *conn, const char *portal)
int PQsetChunkedRowsMode(PGconn *conn, int chunkSize)
char * PQresultErrorField(const PGresult *res, int fieldcode)
int PQsendQuery(PGconn *conn, const char *query)
char * PQcmdStatus(PGresult *res)
int PQpipelineSync(PGconn *conn)
int PQsendDescribePortal(PGconn *conn, const char *portal)
char * PQresStatus(ExecStatusType status)
int PQisBusy(PGconn *conn)
PGresult * PQexec(PGconn *conn, const char *query)
int PQsendQueryPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
int PQsendFlushRequest(PGconn *conn)
int PQisnonblocking(const PGconn *conn)
int PQnfields(const PGresult *res)
void PQtrace(PGconn *conn, FILE *debug_port)
void PQsetTraceFlags(PGconn *conn, int flags)
void * pg_malloc(size_t size)
char * pg_strdup(const char *in)
void * pg_malloc0(size_t size)
Assert(PointerIsAligned(start, uint64))
static const JsonPathKeyword keywords[]
#define PQTRACE_SUPPRESS_TIMESTAMPS
PostgresPollingStatusType
#define PQTRACE_REGRESS_MODE
static void usage(const char *progname)
static void print_test_list(void)
static const char *const insert_sql2
static void confirm_query_canceled_impl(int line, PGconn *conn)
static void wait_for_connection_state(int line, PGconn *monitorConn, int procpid, char *state, char *event)
static void exit_nicely(PGconn *conn)
int main(int argc, char **argv)
#define confirm_query_canceled(conn)
static void test_uniqviol(PGconn *conn)
static void send_cancellable_query_impl(int line, PGconn *conn, PGconn *monitorConn)
static void test_simple_pipeline(PGconn *conn)
static pg_noreturn void static bool process_result(PGconn *conn, PGresult *res, int results, int numsent)
static void test_multi_pipelines(PGconn *conn)
static void test_pipeline_idle(PGconn *conn)
static const char *const create_table_sql
static const char *const insert_sql
static void test_protocol_version(PGconn *conn)
static void test_nosync(PGconn *conn)
static const char *const progname
static void test_pipeline_abort(PGconn *conn)
static pg_noreturn void pg_fatal_impl(int line, const char *fmt,...) pg_attribute_printf(2
static const char *const drop_table_sql
#define send_cancellable_query(conn, monitorConn)
static void notice_processor(void *arg, const char *message)
static void test_transaction(PGconn *conn)
static PGconn * copy_connection(PGconn *conn)
static void test_prepared(PGconn *conn)
static void test_cancel(PGconn *conn)
static void test_singlerowmode(PGconn *conn)
static void test_disallowed_in_pipeline(PGconn *conn)
static void test_pipelined_insert(PGconn *conn, int n_rows)
void pfree(void *pointer)
static AmcheckOptions opts
int getopt(int nargc, char *const *nargv, const char *ostr)
PGDLLIMPORT char * optarg
char * psprintf(const char *fmt,...)
void pg_usleep(long microsec)
#define select(n, r, w, e, timeout)