PostgreSQL Source Code git master
|
#include "postgres_fe.h"
#include <sys/select.h>
#include <sys/time.h>
#include "catalog/pg_type_d.h"
#include "libpq-fe.h"
#include "pg_getopt.h"
Go to the source code of this file.
Macros | |
#define | pg_debug(...) |
#define | MAXINTLEN 12 |
#define | MAXINT8LEN 20 |
#define | pg_fatal(...) pg_fatal_impl(__LINE__, __VA_ARGS__) |
#define | confirm_query_canceled(conn) confirm_query_canceled_impl(__LINE__, conn) |
#define | send_cancellable_query(conn, monitorConn) send_cancellable_query_impl(__LINE__, conn, monitorConn) |
Enumerations | |
enum | PipelineInsertStep { BI_BEGIN_TX , BI_DROP_TABLE , BI_CREATE_TABLE , BI_PREPARE , BI_INSERT_ROWS , BI_COMMIT_TX , BI_SYNC , BI_DONE } |
Functions | |
static void | exit_nicely (PGconn *conn) |
static pg_noreturn void | pg_fatal_impl (int line, const char *fmt,...) pg_attribute_printf(2 |
static pg_noreturn void static bool | process_result (PGconn *conn, PGresult *res, int results, int numsent) |
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 | send_cancellable_query_impl (int line, PGconn *conn, PGconn *monitorConn) |
static PGconn * | copy_connection (PGconn *conn) |
static void | test_cancel (PGconn *conn) |
static void | test_disallowed_in_pipeline (PGconn *conn) |
static void | test_multi_pipelines (PGconn *conn) |
static void | test_nosync (PGconn *conn) |
static void | test_pipeline_abort (PGconn *conn) |
static void | test_pipelined_insert (PGconn *conn, int n_rows) |
static void | test_prepared (PGconn *conn) |
static void | test_protocol_version (PGconn *conn) |
static void | notice_processor (void *arg, const char *message) |
static void | test_pipeline_idle (PGconn *conn) |
static void | test_simple_pipeline (PGconn *conn) |
static void | test_singlerowmode (PGconn *conn) |
static void | test_transaction (PGconn *conn) |
static void | test_uniqviol (PGconn *conn) |
static void | usage (const char *progname) |
static void | print_test_list (void) |
int | main (int argc, char **argv) |
Variables | |
static const char *const | progname = "libpq_pipeline" |
static char * | tracefile = NULL |
static const char *const | drop_table_sql |
static const char *const | create_table_sql |
static const char *const | insert_sql |
static const char *const | insert_sql2 |
#define confirm_query_canceled | ( | conn | ) | confirm_query_canceled_impl(__LINE__, conn) |
Definition at line 93 of file libpq_pipeline.c.
#define MAXINT8LEN 20 |
Definition at line 56 of file libpq_pipeline.c.
#define MAXINTLEN 12 |
Definition at line 55 of file libpq_pipeline.c.
#define pg_debug | ( | ... | ) |
Definition at line 41 of file libpq_pipeline.c.
#define pg_fatal | ( | ... | ) | pg_fatal_impl(__LINE__, __VA_ARGS__) |
Definition at line 73 of file libpq_pipeline.c.
#define send_cancellable_query | ( | conn, | |
monitorConn | |||
) | send_cancellable_query_impl(__LINE__, conn, monitorConn) |
Definition at line 169 of file libpq_pipeline.c.
enum PipelineInsertStep |
Enumerator | |
---|---|
BI_BEGIN_TX | |
BI_DROP_TABLE | |
BI_CREATE_TABLE | |
BI_PREPARE | |
BI_INSERT_ROWS | |
BI_COMMIT_TX | |
BI_SYNC | |
BI_DONE |
Definition at line 994 of file libpq_pipeline.c.
|
static |
Definition at line 95 of file libpq_pipeline.c.
References conn, PG_DIAG_SQLSTATE, pg_fatal_impl(), PGRES_FATAL_ERROR, PQclear(), PQconsumeInput(), PQerrorMessage(), PQgetResult(), PQisBusy(), PQresultErrorField(), and PQresultStatus().
Definition at line 203 of file libpq_pipeline.c.
References conn, CONNECTION_OK, i, JsonPathKeyword::keyword, keywords, opts, pg_fatal, pg_malloc(), PQconnectdbParams(), PQconninfo(), PQerrorMessage(), and PQstatus().
Referenced by test_cancel().
|
static |
Definition at line 59 of file libpq_pipeline.c.
References conn, and PQfinish().
Referenced by main(), test_nosync(), and test_pipelined_insert().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 2270 of file libpq_pipeline.c.
References conn, CONNECTION_OK, exit_nicely(), fprintf, getopt(), optarg, optind, pg_fatal, PG_IOLBF, pg_strdup(), PGRES_COMMAND_OK, PQconnectdb(), PQerrorMessage(), PQexec(), PQfinish(), PQresultStatus(), PQsetTraceFlags(), PQstatus(), PQtrace(), PQTRACE_REGRESS_MODE, PQTRACE_SUPPRESS_TIMESTAMPS, print_test_list(), generate_unaccent_rules::stdout, test_cancel(), test_disallowed_in_pipeline(), test_multi_pipelines(), test_nosync(), test_pipeline_abort(), test_pipeline_idle(), test_pipelined_insert(), test_prepared(), test_protocol_version(), test_simple_pipeline(), test_singlerowmode(), test_transaction(), test_uniqviol(), tracefile, and usage().
|
static |
Definition at line 1516 of file libpq_pipeline.c.
Referenced by test_pipeline_idle().
|
static |
Definition at line 75 of file libpq_pipeline.c.
References generate_unaccent_rules::args, Assert(), fprintf, progname, generate_unaccent_rules::stdout, and vfprintf.
Referenced by confirm_query_canceled_impl(), send_cancellable_query_impl(), and wait_for_connection_state().
|
static |
Definition at line 2252 of file libpq_pipeline.c.
References printf.
Referenced by main().
Definition at line 2192 of file libpq_pipeline.c.
References conn, fprintf, pg_fatal, PGRES_FATAL_ERROR, PGRES_PIPELINE_ABORTED, PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQgetResult(), PQgetvalue(), PQresStatus(), and PQresultStatus().
Referenced by test_uniqviol().
Definition at line 172 of file libpq_pipeline.c.
References conn, pg_fatal_impl(), PQbackendPID(), PQerrorMessage(), PQsendQueryParams(), and wait_for_connection_state().
|
static |
Definition at line 244 of file libpq_pipeline.c.
References Assert(), cancelConn, confirm_query_canceled, conn, CONNECTION_OK, copy_connection(), EINTR, fprintf, pg_debug, pg_fatal, PGRES_POLLING_OK, PGRES_POLLING_READING, PGRES_POLLING_WRITING, PQcancel(), PQcancelBlocking(), PQcancelCreate(), PQcancelErrorMessage(), PQcancelFinish(), PQcancelPoll(), PQcancelReset(), PQcancelSocket(), PQcancelStart(), PQcancelStatus(), PQerrorMessage(), PQfreeCancel(), PQgetCancel(), PQrequestCancel(), PQsetnonblocking(), PQstatus(), select, and send_cancellable_query.
Referenced by main().
|
static |
Definition at line 408 of file libpq_pipeline.c.
References conn, fprintf, pg_fatal, PGRES_FATAL_ERROR, PGRES_TUPLES_OK, PQ_PIPELINE_OFF, PQenterPipelineMode(), PQerrorMessage(), PQexec(), PQexitPipelineMode(), PQisBusy(), PQisnonblocking(), PQpipelineStatus(), PQresultStatus(), and PQsendQuery().
Referenced by main().
|
static |
Definition at line 468 of file libpq_pipeline.c.
References conn, fprintf, pg_fatal, PGRES_PIPELINE_SYNC, PGRES_TUPLES_OK, PQ_PIPELINE_OFF, PQclear(), PQenterPipelineMode(), PQerrorMessage(), PQexitPipelineMode(), PQgetResult(), PQpipelineStatus(), PQpipelineSync(), PQresStatus(), PQresultStatus(), PQsendPipelineSync(), and PQsendQueryParams().
Referenced by main().
|
static |
Definition at line 613 of file libpq_pipeline.c.
References conn, exit_nicely(), fprintf, i, pg_fatal, PGRES_TUPLES_OK, PQclear(), PQconsumeInput(), PQenterPipelineMode(), PQerrorMessage(), PQflush(), PQgetResult(), PQresStatus(), PQresultStatus(), PQsendFlushRequest(), PQsendQueryParams(), PQsocket(), and select.
Referenced by main().
|
static |
Definition at line 705 of file libpq_pipeline.c.
References conn, create_table_sql, drop_table_sql, fprintf, i, insert_sql, PG_DIAG_SQLSTATE, pg_fatal, PGRES_COMMAND_OK, PGRES_FATAL_ERROR, PGRES_PIPELINE_ABORTED, PGRES_PIPELINE_SYNC, PGRES_SINGLE_TUPLE, PGRES_TUPLES_OK, PQ_PIPELINE_ABORTED, PQ_PIPELINE_OFF, PQclear(), PQenterPipelineMode(), PQerrorMessage(), PQexec(), PQexitPipelineMode(), PQgetResult(), PQgetvalue(), PQntuples(), PQpipelineStatus(), PQpipelineSync(), PQresStatus(), PQresultErrorField(), PQresultErrorMessage(), PQresultStatus(), PQsendQueryParams(), PQsetSingleRowMode(), printf, and val.
Referenced by main().
|
static |
Definition at line 1526 of file libpq_pipeline.c.
References conn, fprintf, notice_processor(), pg_fatal, PGRES_TUPLES_OK, PQclear(), PQenterPipelineMode(), PQerrorMessage(), PQexitPipelineMode(), PQgetResult(), PQresStatus(), PQresultStatus(), PQsendFlushRequest(), PQsendQueryParams(), and PQsetNoticeProcessor().
Referenced by main().
|
static |
Definition at line 1007 of file libpq_pipeline.c.
References Assert(), BI_BEGIN_TX, BI_COMMIT_TX, BI_CREATE_TABLE, BI_DONE, BI_DROP_TABLE, BI_INSERT_ROWS, BI_PREPARE, BI_SYNC, conn, create_table_sql, description, drop_table_sql, exit_nicely(), fprintf, insert_sql2, MAXINT8LEN, MAXINTLEN, pg_debug, pg_fatal, PGRES_COMMAND_OK, PGRES_PIPELINE_SYNC, PQclear(), PQcmdStatus(), PQconsumeInput(), PQenterPipelineMode(), PQerrorMessage(), PQexitPipelineMode(), PQflush(), PQgetResult(), PQisBusy(), PQpipelineSync(), PQresStatus(), PQresultStatus(), PQsendPrepare(), PQsendQueryParams(), PQsendQueryPrepared(), PQsetnonblocking(), PQsocket(), select, snprintf, and generate_unaccent_rules::stdout.
Referenced by main().
|
static |
Definition at line 1253 of file libpq_pipeline.c.
References conn, fprintf, i, lengthof, pg_fatal, PGRES_COMMAND_OK, PGRES_FATAL_ERROR, PGRES_PIPELINE_SYNC, PQclear(), PQclosePortal(), PQclosePrepared(), PQdescribePortal(), PQdescribePrepared(), PQenterPipelineMode(), PQerrorMessage(), PQexec(), PQexitPipelineMode(), PQftype(), PQgetResult(), PQnfields(), PQpipelineSync(), PQresStatus(), PQresultStatus(), PQsendClosePortal(), PQsendClosePrepared(), PQsendDescribePortal(), PQsendDescribePrepared(), and PQsendPrepare().
Referenced by main().
|
static |
Definition at line 1414 of file libpq_pipeline.c.
References conn, CONNECTION_BAD, CONNECTION_OK, i, JsonPathKeyword::keyword, keywords, opts, pg_fatal, pg_malloc0(), PQconnectdbParams(), PQconninfo(), PQerrorMessage(), PQfinish(), PQfullProtocolVersion(), and PQstatus().
Referenced by main().
|
static |
Definition at line 1593 of file libpq_pipeline.c.
References conn, fprintf, pg_fatal, PGRES_PIPELINE_SYNC, PGRES_TUPLES_OK, PQ_PIPELINE_OFF, PQclear(), PQenterPipelineMode(), PQerrorMessage(), PQexitPipelineMode(), PQgetResult(), PQisnonblocking(), PQpipelineStatus(), PQpipelineSync(), PQresStatus(), PQresultStatus(), and PQsendQueryParams().
Referenced by main().
|
static |
Definition at line 1680 of file libpq_pipeline.c.
References conn, fprintf, i, pfree(), pg_fatal, PGRES_PIPELINE_SYNC, PGRES_SINGLE_TUPLE, PGRES_TUPLES_CHUNK, PGRES_TUPLES_OK, PQclear(), PQenterPipelineMode(), PQerrorMessage(), PQexitPipelineMode(), PQgetResult(), PQgetvalue(), PQntuples(), PQpipelineSync(), PQresStatus(), PQresultStatus(), PQsendFlushRequest(), PQsendQueryParams(), PQsetChunkedRowsMode(), PQsetSingleRowMode(), and psprintf().
Referenced by main().
|
static |
Definition at line 1876 of file libpq_pipeline.c.
References conn, fprintf, i, pg_fatal, PGRES_COMMAND_OK, PGRES_FATAL_ERROR, PGRES_PIPELINE_ABORTED, PGRES_PIPELINE_SYNC, PGRES_TUPLES_OK, PQclear(), PQenterPipelineMode(), PQerrorMessage(), PQexec(), PQexitPipelineMode(), PQgetResult(), PQgetvalue(), PQntuples(), PQpipelineSync(), PQresStatus(), PQresultStatus(), PQsendPrepare(), PQsendQueryParams(), PQsendQueryPrepared(), and printf.
Referenced by main().
|
static |
Definition at line 2024 of file libpq_pipeline.c.
References conn, EINTR, fprintf, MAXINT8LEN, pg_fatal, PGRES_COMMAND_OK, PQconsumeInput(), PQenterPipelineMode(), PQerrorMessage(), PQexec(), PQflush(), PQgetResult(), PQisBusy(), PQprepare(), PQresultStatus(), PQsendFlushRequest(), PQsendQueryPrepared(), PQsetnonblocking(), PQsocket(), process_result(), select, and sprintf.
Referenced by main().
|
static |
Definition at line 2240 of file libpq_pipeline.c.
References fprintf, and progname.
Referenced by main().
|
static |
Definition at line 120 of file libpq_pipeline.c.
References Assert(), pfree(), pg_fatal_impl(), pg_usleep(), PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQexecParams(), PQgetvalue(), PQnfields(), PQntuples(), PQresultStatus(), psprintf(), and value.
Referenced by send_cancellable_query_impl().
|
static |
Definition at line 46 of file libpq_pipeline.c.
Referenced by test_pipeline_abort(), and test_pipelined_insert().
|
static |
Definition at line 44 of file libpq_pipeline.c.
Referenced by test_pipeline_abort(), and test_pipelined_insert().
|
static |
Definition at line 49 of file libpq_pipeline.c.
Referenced by test_pipeline_abort().
|
static |
Definition at line 51 of file libpq_pipeline.c.
Referenced by test_pipelined_insert().
|
static |
Definition at line 32 of file libpq_pipeline.c.
Referenced by pg_fatal_impl(), and usage().
|
static |
Definition at line 35 of file libpq_pipeline.c.
Referenced by main().