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');
94#define confirm_result_status(conn, status) confirm_result_status_impl(__LINE__, conn, status)
102 pg_fatal_impl(line,
"PQgetResult returned null unexpectedly: %s",
105 pg_fatal_impl(line,
"PQgetResult returned status %s, expected %s: %s",
116#define consume_result_status(conn, status) consume_result_status_impl(__LINE__, conn, status)
129#define consume_null_result(conn) consume_null_result_impl(__LINE__, conn)
145#define consume_query_cancel(conn) consume_query_cancel_impl(__LINE__, conn)
153 pg_fatal_impl(line,
"query failed with a different error than cancellation: %s",
168 char *
state,
char *event)
170 const Oid paramTypes[] = {INT4OID, TEXTOID};
171 const char *paramValues[2];
172 char *pidstr =
psprintf(
"%d", procpid);
176 paramValues[0] = pidstr;
186 "SELECT count(*) FROM pg_stat_activity WHERE "
187 "pid = $1 AND state = $2",
188 2, paramTypes, paramValues, NULL, NULL, 0);
191 "SELECT count(*) FROM pg_stat_activity WHERE "
192 "pid = $1 AND wait_event = $2",
193 2, paramTypes, paramValues, NULL, NULL, 0);
202 if (strcmp(
value,
"0") != 0)
216#define send_cancellable_query(conn, monitorConn) \
217 send_cancellable_query_impl(__LINE__, conn, monitorConn)
221 const char *env_wait;
222 const Oid paramTypes[1] = {INT4OID};
231 env_wait = getenv(
"PG_TEST_TIMEOUT_DEFAULT");
232 if (env_wait == NULL)
236 &env_wait, NULL, NULL, 0) != 1)
264 vals =
pg_malloc(
sizeof(
char *) * nopts);
281 pg_fatal(
"Connection to database failed: %s",
302 fprintf(stderr,
"test cancellations... ");
317 if (!
PQcancel(cancel, errorbuf,
sizeof(errorbuf)))
318 pg_fatal(
"failed to run PQcancel: %s", errorbuf);
323 if (!
PQcancel(cancel, errorbuf,
sizeof(errorbuf)))
324 pg_fatal(
"failed to run PQcancel: %s", errorbuf);
359 FD_ZERO(&input_mask);
360 FD_ZERO(&output_mask);
365 FD_SET(sock, &input_mask);
369 FD_SET(sock, &output_mask);
383 if (
select(sock + 1, &input_mask, &output_mask, NULL, &tv) < 0)
416 FD_ZERO(&input_mask);
417 FD_ZERO(&output_mask);
422 FD_SET(sock, &input_mask);
426 FD_SET(sock, &output_mask);
440 if (
select(sock + 1, &input_mask, &output_mask, NULL, &tv) < 0)
464 fprintf(stderr,
"test error cases... ");
467 pg_fatal(
"Expected blocking connection mode");
470 pg_fatal(
"Unable to enter pipeline mode");
473 pg_fatal(
"Pipeline mode not activated properly");
478 pg_fatal(
"PQexec should fail in pipeline mode but succeeded");
480 "synchronous command execution functions are not allowed in pipeline mode\n") != 0)
481 pg_fatal(
"did not get expected error message; got: \"%s\"",
487 pg_fatal(
"PQsendQuery should fail in pipeline mode but succeeded");
489 "PQsendQuery not allowed in pipeline mode\n") != 0)
490 pg_fatal(
"did not get expected error message; got: \"%s\"",
495 pg_fatal(
"re-entering pipeline mode should be a no-op but failed");
498 pg_fatal(
"PQisBusy should return 0 when idle in pipeline mode, returned 1");
502 pg_fatal(
"couldn't exit idle empty pipeline mode");
505 pg_fatal(
"Pipeline mode not terminated properly");
509 pg_fatal(
"pipeline mode exit when not in pipeline mode should succeed but failed");
514 pg_fatal(
"PQexec should succeed after exiting pipeline mode but failed with: %s",
524 const char *dummy_params[1] = {
"1"};
525 Oid dummy_param_oids[1] = {INT4OID};
527 fprintf(stderr,
"multi pipeline... ");
538 dummy_params, NULL, NULL, 0) != 1)
546 dummy_params, NULL, NULL, 0) != 1)
555 dummy_params, NULL, NULL, 0) != 1)
569 pg_fatal(
"exiting pipeline mode after query but before sync succeeded incorrectly");
579 pg_fatal(
"exiting pipeline mode after query but before sync succeeded incorrectly");
592 pg_fatal(
"Fell out of pipeline mode somehow");
596 pg_fatal(
"attempt to exit pipeline mode failed when it should've succeeded: %s",
600 pg_fatal(
"exiting pipeline mode didn't seem to work");
622 pg_fatal(
"could not enter pipeline mode");
623 for (
int i = 0;
i < numqueries;
i++)
629 0, NULL, NULL, NULL, NULL, 0) != 1)
636 FD_ZERO(&input_mask);
637 FD_SET(sock, &input_mask);
640 if (
select(sock + 1, &input_mask, NULL, NULL, &tv) < 0)
642 fprintf(stderr,
"select() failed: %m\n");
651 pg_fatal(
"failed to send flush request");
666 if (results == numqueries)
686 const char *dummy_params[1] = {
"1"};
687 Oid dummy_param_oids[1] = {INT4OID};
692 fprintf(stderr,
"aborted pipeline... ");
712 dummy_params[0] =
"1";
714 dummy_params, NULL, NULL, 0) != 1)
718 1, dummy_param_oids, dummy_params,
722 dummy_params[0] =
"2";
724 dummy_params, NULL, NULL, 0) != 1)
730 dummy_params[0] =
"3";
732 dummy_params, NULL, NULL, 0) != 1)
733 pg_fatal(
"dispatching second-pipeline insert failed: %s",
765 pg_fatal(
"pipeline should be flagged as aborted but isn't");
774 pg_fatal(
"pipeline should be flagged as aborted but isn't");
778 pg_fatal(
"Fell out of pipeline mode somehow");
789 pg_fatal(
"sync should've cleared the aborted flag but didn't");
793 pg_fatal(
"Fell out of pipeline mode somehow");
819 pg_fatal(
"expected error about multiple commands, got %s",
831 pg_fatal(
"did not get cannot-insert-multiple-commands error");
840 0, NULL, NULL, NULL, NULL, 0) != 1)
857 pg_fatal(
"expected division-by-zero, got: %s (%s)",
860 printf(
"got expected division-by-zero\n");
869 pg_fatal(
"did not get division-by-zero error");
878 pg_fatal(
"Fell out of pipeline mode somehow");
882 pg_fatal(
"attempt to exit pipeline mode failed when it should've succeeded: %s",
886 pg_fatal(
"exiting pipeline mode didn't seem to work");
903 res =
PQexec(
conn,
"SELECT itemno FROM pq_pipeline_demo");
906 pg_fatal(
"Expected tuples, got %s: %s",
914 if (strcmp(
val,
"3") != 0)
915 pg_fatal(
"expected only insert with value 3, got %s",
val);
939 Oid insert_param_oids[2] = {INT4OID, INT8OID};
940 const char *insert_params[2];
948 insert_params[0] = insert_param_0;
949 insert_params[1] = insert_param_1;
951 rows_to_send = rows_to_receive = n_rows;
966 sql =
"BEGIN TRANSACTION";
987 0, NULL, NULL, NULL, NULL, 0) != 1)
1019 FD_ZERO(&input_mask);
1020 FD_SET(sock, &input_mask);
1021 FD_ZERO(&output_mask);
1022 FD_SET(sock, &output_mask);
1024 if (
select(sock + 1, &input_mask, &output_mask, NULL, NULL) < 0)
1026 fprintf(stderr,
"select() failed: %m\n");
1034 if (FD_ISSET(sock, &input_mask))
1042 const char *cmdtag =
"";
1062 cmdtag =
"DROP TABLE";
1066 cmdtag =
"CREATE TABLE";
1077 if (rows_to_receive == 0)
1096 pg_fatal(
"%s reported status %s, expected %s\n"
1097 "Error message: \"%s\"",
1101 if (strncmp(
PQcmdStatus(res), cmdtag, strlen(cmdtag)) != 0)
1102 pg_fatal(
"%s expected command tag '%s', got '%s'",
1112 if (FD_ISSET(sock, &output_mask))
1123 2, insert_params, NULL, NULL, 0) == 1)
1125 pg_debug(
"sent row %d\n", rows_to_send);
1128 if (rows_to_send == 0)
1137 fprintf(stderr,
"WARNING: failed to send insert #%d: %s\n",
1144 0, NULL, NULL, NULL, NULL, 0) == 1)
1151 fprintf(stderr,
"WARNING: failed to send commit: %s\n",
1155 else if (send_step ==
BI_SYNC)
1164 fprintf(stderr,
"WARNING: pipeline sync failed: %s\n",
1173 pg_fatal(
"attempt to exit pipeline mode failed when it should've succeeded: %s",
1186 Oid param_oids[1] = {INT4OID};
1187 Oid expected_oids[4];
1190 fprintf(stderr,
"prepared... ");
1196 1, param_oids) != 1)
1198 expected_oids[0] = INT4OID;
1199 expected_oids[1] = TEXTOID;
1200 expected_oids[2] = NUMERICOID;
1201 expected_oids[3] = INTERVALOID;
1213 pg_fatal(
"expected %zu columns, got %d",
1218 if (typ != expected_oids[
i])
1219 pg_fatal(
"field %d: expected type %u, got %u",
1220 i, expected_oids[
i], typ);
1228 fprintf(stderr,
"closing statement..");
1258 fprintf(stderr,
"creating portal... ");
1265 res =
PQexec(
conn,
"DECLARE cursor_one CURSOR FOR SELECT 1");
1279 pg_fatal(
"portal: expected type %u, got %u",
1287 fprintf(stderr,
"closing portal... ");
1330 int protocol_version;
1331 int max_protocol_version_index;
1358 max_protocol_version_index =
i;
1366 vals[max_protocol_version_index] =
"3.0";
1370 pg_fatal(
"Connection to database failed: %s",
1374 if (protocol_version != 30000)
1375 pg_fatal(
"expected 30000, got %d", protocol_version);
1383 vals[max_protocol_version_index] =
"3.1";
1387 pg_fatal(
"Connecting with max_protocol_version 3.1 should have failed.");
1394 vals[max_protocol_version_index] =
"3.2";
1398 pg_fatal(
"Connection to database failed: %s",
1402 if (protocol_version != 30002)
1403 pg_fatal(
"expected 30002, got %d", protocol_version);
1410 vals[max_protocol_version_index] =
"latest";
1414 pg_fatal(
"Connection to database failed: %s",
1418 if (protocol_version != 30002)
1419 pg_fatal(
"expected 30002, got %d", protocol_version);
1432 int *n_notices = (
int *)
arg;
1435 fprintf(stderr,
"NOTICE %d: %s", *n_notices, message);
1444 fprintf(stderr,
"\npipeline idle...\n");
1462 pg_fatal(
"exiting pipeline succeeded when it shouldn't");
1464 strlen(
"cannot exit pipeline mode")) != 0)
1465 pg_fatal(
"did not get expected error; got: %s",
1477 pg_fatal(
"got %d notice(s)", n_notices);
1483 if (
PQsendQueryParams(
conn,
"SELECT pg_catalog.pg_advisory_unlock(1,1)", 0, NULL, NULL, NULL, NULL, 0) != 1)
1497 const char *dummy_params[1] = {
"1"};
1498 Oid dummy_param_oids[1] = {INT4OID};
1500 fprintf(stderr,
"simple pipeline... ");
1511 pg_fatal(
"Expected blocking connection mode");
1517 1, dummy_param_oids, dummy_params,
1518 NULL, NULL, 0) != 1)
1522 pg_fatal(
"exiting pipeline mode with work in progress should fail, but succeeded");
1536 pg_fatal(
"exiting pipeline mode after query but before sync succeeded incorrectly");
1544 pg_fatal(
"Fell out of pipeline mode somehow");
1548 pg_fatal(
"attempt to exit pipeline mode failed when it should've succeeded: %s",
1552 pg_fatal(
"Exiting pipeline mode didn't seem to work");
1562 bool pipeline_ended =
false;
1565 pg_fatal(
"failed to enter pipeline mode: %s",
1569 for (
i = 0;
i < 3;
i++)
1576 "SELECT generate_series(42, $1)",
1579 (
const char **) param,
1583 pg_fatal(
"failed to send query: %s",
1590 for (
i = 0; !pipeline_ended;
i++)
1593 bool saw_ending_tuplesok;
1594 bool isSingleTuple =
false;
1600 pg_fatal(
"PQsetSingleRowMode() failed for i=%d",
i);
1604 saw_ending_tuplesok =
false;
1611 fprintf(stderr,
"end of pipeline reached\n");
1612 pipeline_ended =
true;
1615 pg_fatal(
"Expected three results, got %d",
i);
1623 pg_fatal(
"Expected PGRES_SINGLE_TUPLE for query %d, got %s",
1626 pg_fatal(
"Expected PGRES_TUPLES_OK for query %d, got %s",
1636 saw_ending_tuplesok =
true;
1640 fprintf(stderr,
"all tuples received in query %d\n",
i);
1642 pg_fatal(
"Expected to follow PGRES_SINGLE_TUPLE, but received PGRES_TUPLES_OK directly instead");
1647 isSingleTuple =
true;
1656 if (!pipeline_ended && !saw_ending_tuplesok)
1657 pg_fatal(
"didn't get expected terminating TUPLES_OK");
1666 0, NULL, NULL, NULL, NULL, 0) != 1)
1667 pg_fatal(
"failed to send query: %s",
1670 pg_fatal(
"failed to send flush request");
1672 pg_fatal(
"PQsetSingleRowMode() failed");
1681 0, NULL, NULL, NULL, NULL, 0) != 1)
1682 pg_fatal(
"failed to send query: %s",
1685 pg_fatal(
"failed to send flush request");
1696 0, NULL, NULL, NULL, NULL, 0) != 1)
1697 pg_fatal(
"failed to send query: %s",
1700 pg_fatal(
"failed to send flush request");
1702 pg_fatal(
"PQsetChunkedRowsMode() failed");
1738 res =
PQexec(
conn,
"DROP TABLE IF EXISTS pq_pipeline_tst;"
1739 "CREATE TABLE pq_pipeline_tst (id int)");
1741 pg_fatal(
"failed to create test table: %s",
1746 pg_fatal(
"failed to enter pipeline mode: %s",
1749 pg_fatal(
"could not send prepare on pipeline: %s",
1754 0, NULL, NULL, NULL, NULL, 0) != 1)
1755 pg_fatal(
"failed to send query: %s",
1759 0, NULL, NULL, NULL, NULL, 0) != 1)
1760 pg_fatal(
"failed to send query: %s",
1768 pg_fatal(
"failed to execute prepared: %s",
1773 "INSERT INTO pq_pipeline_tst VALUES (1)",
1774 0, NULL, NULL, NULL, NULL, 0) != 1)
1775 pg_fatal(
"failed to send query: %s",
1786 "INSERT INTO pq_pipeline_tst VALUES (2)",
1787 0, NULL, NULL, NULL, NULL, 0) != 1)
1788 pg_fatal(
"failed to send query: %s",
1799 pg_fatal(
"failed to execute prepared: %s",
1807 "INSERT INTO pq_pipeline_tst VALUES (3)",
1808 0, NULL, NULL, NULL, NULL, 0) != 1)
1809 pg_fatal(
"failed to send query: %s",
1819 expect_null =
false;
1820 for (
int i = 0;;
i++)
1827 printf(
"%d: got NULL result\n",
i);
1829 pg_fatal(
"did not expect NULL here");
1830 expect_null =
false;
1841 printf(
": command didn't run because pipeline aborted\n");
1861 res =
PQexec(
conn,
"SELECT * FROM pq_pipeline_tst");
1867 pg_fatal(
"did not get expected tuple");
1883 Oid paramTypes[2] = {INT8OID, INT8OID};
1884 const char *paramValues[2];
1890 bool read_done =
false;
1891 bool write_done =
false;
1892 bool error_sent =
false;
1893 bool got_error =
false;
1899 fprintf(stderr,
"uniqviol ...");
1903 paramValues[0] = paramValue0;
1904 paramValues[1] = paramValue1;
1907 res =
PQexec(
conn,
"drop table if exists ppln_uniqviol;"
1908 "create table ppln_uniqviol(id bigint primary key, idata bigint)");
1919 "insert into ppln_uniqviol values ($1, $2) returning id",
1926 pg_fatal(
"failed to enter pipeline mode");
1941 if (results >= numsent)
1950 if (new_error && got_error)
1952 got_error |= new_error;
1953 if (results++ >= numsent - 1)
1965 FD_SET(sock, &out_fds);
1968 FD_SET(sock, &in_fds);
1970 if (
select(sock + 1, &in_fds, write_done ? NULL : &out_fds, NULL, NULL) == -1)
1984 if (!write_done && FD_ISSET(sock, &out_fds))
1994 if (switched >= 1 && !error_sent && ctr % socketful >= socketful / 2)
1996 sprintf(paramValue0,
"%d", numsent / 2);
2003 sprintf(paramValue0,
"%d", ctr++);
2011 if (socketful != 0 && numsent % socketful == 42 && error_sent)
2014 pg_fatal(
"failed to send flush request");
2016 fprintf(stderr,
"\ndone writing\n");
2028 socketful = numsent;
2029 fprintf(stderr,
"\nswitch to reading\n");
2038 pg_fatal(
"did not get expected error");
2052 bool got_error =
false;
2073 fprintf(stderr,
"result %d/%d: pipeline aborted\n", results, numsent);
2093 fprintf(stderr,
"\nOptions:\n");
2094 fprintf(stderr,
" -t TRACEFILE generate a libpq trace to TRACEFILE\n");
2095 fprintf(stderr,
" -r NUMROWS use NUMROWS as the test size\n");
2102 printf(
"disallowed_in_pipeline\n");
2103 printf(
"multi_pipelines\n");
2105 printf(
"pipeline_abort\n");
2106 printf(
"pipeline_idle\n");
2107 printf(
"pipelined_insert\n");
2109 printf(
"protocol_version\n");
2110 printf(
"simple_pipeline\n");
2119 const char *conninfo =
"";
2123 int numrows = 10000;
2127 while ((
c =
getopt(argc, argv,
"r:t:")) != -1)
2133 numrows = strtol(
optarg, NULL, 10);
2134 if (errno != 0 || numrows <= 0)
2136 fprintf(stderr,
"couldn't parse \"%s\" as a positive integer\n",
2158 if (strcmp(testname,
"tests") == 0)
2174 fprintf(stderr,
"Connection to database failed: %s\n",
2179 res =
PQexec(
conn,
"SET lc_messages TO \"C\"");
2183 res =
PQexec(
conn,
"SET debug_parallel_query = off");
2206 if (strcmp(testname,
"cancel") == 0)
2208 else if (strcmp(testname,
"disallowed_in_pipeline") == 0)
2210 else if (strcmp(testname,
"multi_pipelines") == 0)
2212 else if (strcmp(testname,
"nosync") == 0)
2214 else if (strcmp(testname,
"pipeline_abort") == 0)
2216 else if (strcmp(testname,
"pipeline_idle") == 0)
2218 else if (strcmp(testname,
"pipelined_insert") == 0)
2220 else if (strcmp(testname,
"prepared") == 0)
2222 else if (strcmp(testname,
"protocol_version") == 0)
2224 else if (strcmp(testname,
"simple_pipeline") == 0)
2226 else if (strcmp(testname,
"singlerow") == 0)
2228 else if (strcmp(testname,
"transaction") == 0)
2230 else if (strcmp(testname,
"uniqviol") == 0)
2234 fprintf(stderr,
"\"%s\" is not a recognized test name\n", testname);
2241 if (trace && trace !=
stdout)
#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)
void PQconninfoFree(PQconninfoOption *connOptions)
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)
PGresult * PQclosePortal(PGconn *conn, const char *portal)
int PQsendClosePrepared(PGconn *conn, const char *stmt)
int PQsendPipelineSync(PGconn *conn)
PGresult * PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
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)
int PQsendQuery(PGconn *conn, const char *query)
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)
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 PQresultErrorField
#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 wait_for_connection_state(int line, PGconn *monitorConn, int procpid, char *state, char *event)
#define consume_query_cancel(conn)
static void exit_nicely(PGconn *conn)
int main(int argc, char **argv)
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 void consume_result_status_impl(int line, PGconn *conn, ExecStatusType status)
static const char *const insert_sql
static void consume_null_result_impl(int line, PGconn *conn)
static void test_protocol_version(PGconn *conn)
static void test_nosync(PGconn *conn)
#define consume_null_result(conn)
static PGresult * confirm_result_status_impl(int line, PGconn *conn, ExecStatusType status)
#define confirm_result_status(conn, status)
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)
#define consume_result_status(conn, status)
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 consume_query_cancel_impl(int line, 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)