PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
libpq-fe.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * libpq-fe.h
4 * This file contains definitions for structures and
5 * externs for functions used by frontend postgres applications.
6 *
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/interfaces/libpq/libpq-fe.h
11 *
12 *-------------------------------------------------------------------------
13 */
14
15#ifndef LIBPQ_FE_H
16#define LIBPQ_FE_H
17
18#ifdef __cplusplus
19extern "C"
20{
21#endif
22
23#include <stdint.h>
24#include <stdio.h>
25
26/*
27 * postgres_ext.h defines the backend's externally visible types,
28 * such as Oid.
29 */
30#include "postgres_ext.h"
31
32/*
33 * These symbols may be used in compile-time #ifdef tests for the availability
34 * of v14-and-newer libpq features.
35 */
36/* Features added in PostgreSQL v14: */
37/* Indicates presence of PQenterPipelineMode and friends */
38#define LIBPQ_HAS_PIPELINING 1
39/* Indicates presence of PQsetTraceFlags; also new PQtrace output format */
40#define LIBPQ_HAS_TRACE_FLAGS 1
41
42/* Features added in PostgreSQL v15: */
43/* Indicates that PQsslAttribute(NULL, "library") is useful */
44#define LIBPQ_HAS_SSL_LIBRARY_DETECTION 1
45
46/* Features added in PostgreSQL v17: */
47/* Indicates presence of PGcancelConn typedef and associated routines */
48#define LIBPQ_HAS_ASYNC_CANCEL 1
49/* Indicates presence of PQchangePassword */
50#define LIBPQ_HAS_CHANGE_PASSWORD 1
51/* Indicates presence of PQsetChunkedRowsMode, PGRES_TUPLES_CHUNK */
52#define LIBPQ_HAS_CHUNK_MODE 1
53/* Indicates presence of PQclosePrepared, PQclosePortal, etc */
54#define LIBPQ_HAS_CLOSE_PREPARED 1
55/* Indicates presence of PQsendPipelineSync */
56#define LIBPQ_HAS_SEND_PIPELINE_SYNC 1
57/* Indicates presence of PQsocketPoll, PQgetCurrentTimeUSec */
58#define LIBPQ_HAS_SOCKET_POLL 1
59
60/* Features added in PostgreSQL v18: */
61/* Indicates presence of PQfullProtocolVersion */
62#define LIBPQ_HAS_FULL_PROTOCOL_VERSION 1
63/* Indicates presence of the PQAUTHDATA_PROMPT_OAUTH_DEVICE authdata hook */
64#define LIBPQ_HAS_PROMPT_OAUTH_DEVICE 1
65
66/*
67 * Option flags for PQcopyResult
68 */
69#define PG_COPYRES_ATTRS 0x01
70#define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */
71#define PG_COPYRES_EVENTS 0x04
72#define PG_COPYRES_NOTICEHOOKS 0x08
73
74/* Application-visible enum types */
75
76/*
77 * Although it is okay to add to these lists, values which become unused
78 * should never be removed, nor should constants be redefined - that would
79 * break compatibility with existing code.
80 */
81
82typedef enum
83{
86 /* Non-blocking mode only below here */
87
88 /*
89 * The existence of these should never be relied upon - they should only
90 * be used for user feedback or similar purposes.
91 */
92 CONNECTION_STARTED, /* Waiting for connection to be made. */
93 CONNECTION_MADE, /* Connection OK; waiting to send. */
94 CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
95 * postmaster. */
96 CONNECTION_AUTH_OK, /* Received authentication; waiting for
97 * backend startup. */
98 CONNECTION_SETENV, /* This state is no longer used. */
99 CONNECTION_SSL_STARTUP, /* Performing SSL handshake. */
100 CONNECTION_NEEDED, /* Internal state: connect() needed. */
101 CONNECTION_CHECK_WRITABLE, /* Checking if session is read-write. */
102 CONNECTION_CONSUME, /* Consuming any extra messages. */
103 CONNECTION_GSS_STARTUP, /* Negotiating GSSAPI. */
104 CONNECTION_CHECK_TARGET, /* Internal state: checking target server
105 * properties. */
106 CONNECTION_CHECK_STANDBY, /* Checking if server is in standby mode. */
107 CONNECTION_ALLOCATED, /* Waiting for connection attempt to be
108 * started. */
109 CONNECTION_AUTHENTICATING, /* Authentication is in progress with some
110 * external system. */
112
113typedef enum
114{
116 PGRES_POLLING_READING, /* These two indicate that one may */
117 PGRES_POLLING_WRITING, /* use select before polling again. */
119 PGRES_POLLING_ACTIVE /* unused; keep for backwards compatibility */
121
122typedef enum
123{
124 PGRES_EMPTY_QUERY = 0, /* empty query string was executed */
125 PGRES_COMMAND_OK, /* a query command that doesn't return
126 * anything was executed properly by the
127 * backend */
128 PGRES_TUPLES_OK, /* a query command that returns tuples was
129 * executed properly by the backend, PGresult
130 * contains the result tuples */
131 PGRES_COPY_OUT, /* Copy Out data transfer in progress */
132 PGRES_COPY_IN, /* Copy In data transfer in progress */
133 PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the
134 * backend */
135 PGRES_NONFATAL_ERROR, /* notice or warning message */
136 PGRES_FATAL_ERROR, /* query failed */
137 PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */
138 PGRES_SINGLE_TUPLE, /* single tuple from larger resultset */
139 PGRES_PIPELINE_SYNC, /* pipeline synchronization point */
140 PGRES_PIPELINE_ABORTED, /* Command didn't run because of an abort
141 * earlier in a pipeline */
142 PGRES_TUPLES_CHUNK /* chunk of tuples from larger resultset */
144
145typedef enum
146{
147 PQTRANS_IDLE, /* connection idle */
148 PQTRANS_ACTIVE, /* command in progress */
149 PQTRANS_INTRANS, /* idle, within transaction block */
150 PQTRANS_INERROR, /* idle, within failed transaction */
151 PQTRANS_UNKNOWN /* cannot determine status */
153
154typedef enum
155{
156 PQERRORS_TERSE, /* single-line error messages */
157 PQERRORS_DEFAULT, /* recommended style */
158 PQERRORS_VERBOSE, /* all the facts, ma'am */
159 PQERRORS_SQLSTATE /* only error severity and SQLSTATE code */
161
162typedef enum
163{
164 PQSHOW_CONTEXT_NEVER, /* never show CONTEXT field */
165 PQSHOW_CONTEXT_ERRORS, /* show CONTEXT for errors only (default) */
166 PQSHOW_CONTEXT_ALWAYS /* always show CONTEXT field */
168
169/*
170 * PGPing - The ordering of this enum should not be altered because the
171 * values are exposed externally via pg_isready.
172 */
173
174typedef enum
175{
176 PQPING_OK, /* server is accepting connections */
177 PQPING_REJECT, /* server is alive but rejecting connections */
178 PQPING_NO_RESPONSE, /* could not establish connection */
179 PQPING_NO_ATTEMPT /* connection not attempted (bad params) */
181
182/*
183 * PGpipelineStatus - Current status of pipeline mode
184 */
185typedef enum
186{
191
192typedef enum
193{
194 PQAUTHDATA_PROMPT_OAUTH_DEVICE, /* user must visit a device-authorization
195 * URL */
196 PQAUTHDATA_OAUTH_BEARER_TOKEN, /* server requests an OAuth Bearer token */
197} PGauthData;
198
199/* PGconn encapsulates a connection to the backend.
200 * The contents of this struct are not supposed to be known to applications.
201 */
202typedef struct pg_conn PGconn;
203
204/* PGcancelConn encapsulates a cancel connection to the backend.
205 * The contents of this struct are not supposed to be known to applications.
206 */
208
209/* PGresult encapsulates the result of a query (or more precisely, of a single
210 * SQL command --- a query string given to PQsendQuery can contain multiple
211 * commands and thus return multiple PGresult objects).
212 * The contents of this struct are not supposed to be known to applications.
213 */
214typedef struct pg_result PGresult;
215
216/* PGcancel encapsulates the information needed to cancel a running
217 * query on an existing connection.
218 * The contents of this struct are not supposed to be known to applications.
219 */
220typedef struct pg_cancel PGcancel;
221
222/* PGnotify represents the occurrence of a NOTIFY message.
223 * Ideally this would be an opaque typedef, but it's so simple that it's
224 * unlikely to change.
225 * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
226 * whereas in earlier versions it was always your own backend's PID.
227 */
228typedef struct pgNotify
229{
230 char *relname; /* notification condition name */
231 int be_pid; /* process ID of notifying server process */
232 char *extra; /* notification parameter */
233 /* Fields below here are private to libpq; apps should not use 'em */
234 struct pgNotify *next; /* list link */
236
237/* deprecated name for int64_t */
238typedef int64_t pg_int64;
239
240/* pg_usec_time_t is like time_t, but with microsecond resolution */
241typedef int64_t pg_usec_time_t;
242
243/* Function types for notice-handling callbacks */
244typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res);
245typedef void (*PQnoticeProcessor) (void *arg, const char *message);
246
247/* Print options for PQprint() */
248typedef char pqbool;
249
250typedef struct _PQprintOpt
251{
252 pqbool header; /* print output field headings and row count */
253 pqbool align; /* fill align the fields */
254 pqbool standard; /* old brain dead format */
255 pqbool html3; /* output html tables */
256 pqbool expanded; /* expand tables */
257 pqbool pager; /* use pager for output if needed */
258 char *fieldSep; /* field separator */
259 char *tableOpt; /* insert to HTML <table ...> */
260 char *caption; /* HTML <caption> */
261 char **fieldName; /* null terminated array of replacement field
262 * names */
264
265/* ----------------
266 * Structure for the conninfo parameter definitions returned by PQconndefaults
267 * or PQconninfoParse.
268 *
269 * All fields except "val" point at static strings which must not be altered.
270 * "val" is either NULL or a malloc'd current-value string. PQconninfoFree()
271 * will release both the val strings and the PQconninfoOption array itself.
272 * ----------------
273 */
274typedef struct _PQconninfoOption
275{
276 char *keyword; /* The keyword of the option */
277 char *envvar; /* Fallback environment variable name */
278 char *compiled; /* Fallback compiled in default value */
279 char *val; /* Option's current value, or NULL */
280 char *label; /* Label for field in connect dialog */
281 char *dispchar; /* Indicates how to display this field in a
282 * connect dialog. Values are: "" Display
283 * entered value as is "*" Password field -
284 * hide value "D" Debug option - don't show
285 * by default */
286 int dispsize; /* Field size in characters for dialog */
288
289/* ----------------
290 * PQArgBlock -- structure for PQfn() arguments
291 * ----------------
292 */
293typedef struct
294{
295 int len;
296 int isint;
297 union
298 {
299 int *ptr; /* can't use void (dec compiler barfs) */
301 } u;
302} PQArgBlock;
303
304/* ----------------
305 * PGresAttDesc -- Data about a single attribute (column) of a query result
306 * ----------------
307 */
308typedef struct pgresAttDesc
309{
310 char *name; /* column name */
311 Oid tableid; /* source table, if known */
312 int columnid; /* source column, if known */
313 int format; /* format code for value (text/binary) */
314 Oid typid; /* type id */
315 int typlen; /* type size */
316 int atttypmod; /* type-specific modifier info */
318
319/* ----------------
320 * Exported functions of libpq
321 * ----------------
322 */
323
324/* === in fe-connect.c === */
325
326/* make a new client connection to the backend */
327/* Asynchronous (non-blocking) */
328extern PGconn *PQconnectStart(const char *conninfo);
329extern PGconn *PQconnectStartParams(const char *const *keywords,
330 const char *const *values, int expand_dbname);
332
333/* Synchronous (blocking) */
334extern PGconn *PQconnectdb(const char *conninfo);
335extern PGconn *PQconnectdbParams(const char *const *keywords,
336 const char *const *values, int expand_dbname);
337extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
338 const char *pgoptions, const char *pgtty,
339 const char *dbName,
340 const char *login, const char *pwd);
341
342#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \
343 PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
344
345/* close the current connection and free the PGconn data structure */
346extern void PQfinish(PGconn *conn);
347
348/* get info about connection options known to PQconnectdb */
349extern PQconninfoOption *PQconndefaults(void);
350
351/* parse connection options in same way as PQconnectdb */
352extern PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg);
353
354/* return the connection options used by a live connection */
356
357/* free the data structure returned by PQconndefaults() or PQconninfoParse() */
358extern void PQconninfoFree(PQconninfoOption *connOptions);
359
360/*
361 * close the current connection and reestablish a new one with the same
362 * parameters
363 */
364/* Asynchronous (non-blocking) */
365extern int PQresetStart(PGconn *conn);
367
368/* Synchronous (blocking) */
369extern void PQreset(PGconn *conn);
370
371/* Create a PGcancelConn that's used to cancel a query on the given PGconn */
373
374/* issue a cancel request in a non-blocking manner */
376
377/* issue a blocking cancel request */
379
380/* poll a non-blocking cancel request */
383extern int PQcancelSocket(const PGcancelConn *cancelConn);
384extern char *PQcancelErrorMessage(const PGcancelConn *cancelConn);
387
388
389/* request a cancel structure */
391
392/* free a cancel structure */
393extern void PQfreeCancel(PGcancel *cancel);
394
395/* deprecated version of PQcancelBlocking, but one which is signal-safe */
396extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize);
397
398/* deprecated version of PQcancel; not thread-safe */
399extern int PQrequestCancel(PGconn *conn);
400
401/* Accessor functions for PGconn objects */
402extern char *PQdb(const PGconn *conn);
403extern char *PQservice(const PGconn *conn);
404extern char *PQuser(const PGconn *conn);
405extern char *PQpass(const PGconn *conn);
406extern char *PQhost(const PGconn *conn);
407extern char *PQhostaddr(const PGconn *conn);
408extern char *PQport(const PGconn *conn);
409extern char *PQtty(const PGconn *conn);
410extern char *PQoptions(const PGconn *conn);
411extern ConnStatusType PQstatus(const PGconn *conn);
413extern const char *PQparameterStatus(const PGconn *conn,
414 const char *paramName);
415extern int PQprotocolVersion(const PGconn *conn);
416extern int PQfullProtocolVersion(const PGconn *conn);
417extern int PQserverVersion(const PGconn *conn);
418extern char *PQerrorMessage(const PGconn *conn);
419extern int PQsocket(const PGconn *conn);
420extern int PQbackendPID(const PGconn *conn);
422extern int PQconnectionNeedsPassword(const PGconn *conn);
423extern int PQconnectionUsedPassword(const PGconn *conn);
424extern int PQconnectionUsedGSSAPI(const PGconn *conn);
425extern int PQclientEncoding(const PGconn *conn);
426extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
427
428/* SSL information functions */
429extern int PQsslInUse(PGconn *conn);
430extern void *PQsslStruct(PGconn *conn, const char *struct_name);
431extern const char *PQsslAttribute(PGconn *conn, const char *attribute_name);
432extern const char *const *PQsslAttributeNames(PGconn *conn);
433
434/* Get the OpenSSL structure associated with a connection. Returns NULL for
435 * unencrypted connections or if any other TLS library is in use. */
436extern void *PQgetssl(PGconn *conn);
437
438/* Tell libpq whether it needs to initialize OpenSSL */
439extern void PQinitSSL(int do_init);
440
441/* More detailed way to tell libpq whether it needs to initialize OpenSSL */
442extern void PQinitOpenSSL(int do_ssl, int do_crypto);
443
444/* Return true if GSSAPI encryption is in use */
445extern int PQgssEncInUse(PGconn *conn);
446
447/* Returns GSSAPI context if GSSAPI is in use */
448extern void *PQgetgssctx(PGconn *conn);
449
450/* Set verbosity for PQerrorMessage and PQresultErrorMessage */
452
453/* Set CONTEXT visibility for PQerrorMessage and PQresultErrorMessage */
455 PGContextVisibility show_context);
456
457/* Override default notice handling routines */
459 PQnoticeReceiver proc,
460 void *arg);
463 void *arg);
464
465/*
466 * Used to set callback that prevents concurrent access to
467 * non-thread safe functions that libpq needs.
468 * The default implementation uses a libpq internal mutex.
469 * Only required for multithreaded apps that use kerberos
470 * both within their app and for postgresql connections.
471 */
472typedef void (*pgthreadlock_t) (int acquire);
473
475
476/* === in fe-trace.c === */
477extern void PQtrace(PGconn *conn, FILE *debug_port);
478extern void PQuntrace(PGconn *conn);
479
480/* flags controlling trace output: */
481/* omit timestamps from each line */
482#define PQTRACE_SUPPRESS_TIMESTAMPS (1<<0)
483/* redact portions of some messages, for testing frameworks */
484#define PQTRACE_REGRESS_MODE (1<<1)
485extern void PQsetTraceFlags(PGconn *conn, int flags);
486
487/* === in fe-exec.c === */
488
489/* Simple synchronous query */
490extern PGresult *PQexec(PGconn *conn, const char *query);
492 const char *command,
493 int nParams,
494 const Oid *paramTypes,
495 const char *const *paramValues,
496 const int *paramLengths,
497 const int *paramFormats,
498 int resultFormat);
499extern PGresult *PQprepare(PGconn *conn, const char *stmtName,
500 const char *query, int nParams,
501 const Oid *paramTypes);
503 const char *stmtName,
504 int nParams,
505 const char *const *paramValues,
506 const int *paramLengths,
507 const int *paramFormats,
508 int resultFormat);
509
510/* Interface for multiple-result or asynchronous queries */
511#define PQ_QUERY_PARAM_MAX_LIMIT 65535
512
513extern int PQsendQuery(PGconn *conn, const char *query);
514extern int PQsendQueryParams(PGconn *conn,
515 const char *command,
516 int nParams,
517 const Oid *paramTypes,
518 const char *const *paramValues,
519 const int *paramLengths,
520 const int *paramFormats,
521 int resultFormat);
522extern int PQsendPrepare(PGconn *conn, const char *stmtName,
523 const char *query, int nParams,
524 const Oid *paramTypes);
526 const char *stmtName,
527 int nParams,
528 const char *const *paramValues,
529 const int *paramLengths,
530 const int *paramFormats,
531 int resultFormat);
532extern int PQsetSingleRowMode(PGconn *conn);
533extern int PQsetChunkedRowsMode(PGconn *conn, int chunkSize);
535
536/* Routines for managing an asynchronous query */
537extern int PQisBusy(PGconn *conn);
538extern int PQconsumeInput(PGconn *conn);
539
540/* Routines for pipeline mode management */
541extern int PQenterPipelineMode(PGconn *conn);
542extern int PQexitPipelineMode(PGconn *conn);
543extern int PQpipelineSync(PGconn *conn);
544extern int PQsendFlushRequest(PGconn *conn);
545extern int PQsendPipelineSync(PGconn *conn);
546
547/* LISTEN/NOTIFY support */
549
550/* Routines for copy in/out */
551extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes);
552extern int PQputCopyEnd(PGconn *conn, const char *errormsg);
553extern int PQgetCopyData(PGconn *conn, char **buffer, int async);
554
555/* Deprecated routines for copy in/out */
556extern int PQgetline(PGconn *conn, char *buffer, int length);
557extern int PQputline(PGconn *conn, const char *string);
558extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
559extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
560extern int PQendcopy(PGconn *conn);
561
562/* Set blocking/nonblocking connection to the backend */
563extern int PQsetnonblocking(PGconn *conn, int arg);
564extern int PQisnonblocking(const PGconn *conn);
565extern int PQisthreadsafe(void);
566extern PGPing PQping(const char *conninfo);
567extern PGPing PQpingParams(const char *const *keywords,
568 const char *const *values, int expand_dbname);
569
570/* Force the write buffer to be written (or at least try) */
571extern int PQflush(PGconn *conn);
572
573/*
574 * "Fast path" interface --- not really recommended for application
575 * use
576 */
577extern PGresult *PQfn(PGconn *conn,
578 int fnid,
579 int *result_buf,
580 int *result_len,
581 int result_is_int,
582 const PQArgBlock *args,
583 int nargs);
584
585/* Accessor functions for PGresult objects */
586extern ExecStatusType PQresultStatus(const PGresult *res);
587extern char *PQresStatus(ExecStatusType status);
588extern char *PQresultErrorMessage(const PGresult *res);
589extern char *PQresultVerboseErrorMessage(const PGresult *res,
590 PGVerbosity verbosity,
591 PGContextVisibility show_context);
592extern char *PQresultErrorField(const PGresult *res, int fieldcode);
593extern int PQntuples(const PGresult *res);
594extern int PQnfields(const PGresult *res);
595extern int PQbinaryTuples(const PGresult *res);
596extern char *PQfname(const PGresult *res, int field_num);
597extern int PQfnumber(const PGresult *res, const char *field_name);
598extern Oid PQftable(const PGresult *res, int field_num);
599extern int PQftablecol(const PGresult *res, int field_num);
600extern int PQfformat(const PGresult *res, int field_num);
601extern Oid PQftype(const PGresult *res, int field_num);
602extern int PQfsize(const PGresult *res, int field_num);
603extern int PQfmod(const PGresult *res, int field_num);
604extern char *PQcmdStatus(PGresult *res);
605extern char *PQoidStatus(const PGresult *res); /* old and ugly */
606extern Oid PQoidValue(const PGresult *res); /* new and improved */
607extern char *PQcmdTuples(PGresult *res);
608extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
609extern int PQgetlength(const PGresult *res, int tup_num, int field_num);
610extern int PQgetisnull(const PGresult *res, int tup_num, int field_num);
611extern int PQnparams(const PGresult *res);
612extern Oid PQparamtype(const PGresult *res, int param_num);
613
614/* Describe prepared statements and portals */
615extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt);
616extern PGresult *PQdescribePortal(PGconn *conn, const char *portal);
617extern int PQsendDescribePrepared(PGconn *conn, const char *stmt);
618extern int PQsendDescribePortal(PGconn *conn, const char *portal);
619
620/* Close prepared statements and portals */
621extern PGresult *PQclosePrepared(PGconn *conn, const char *stmt);
622extern PGresult *PQclosePortal(PGconn *conn, const char *portal);
623extern int PQsendClosePrepared(PGconn *conn, const char *stmt);
624extern int PQsendClosePortal(PGconn *conn, const char *portal);
625
626/* Delete a PGresult */
627extern void PQclear(PGresult *res);
628
629/* For freeing other alloc'd results, such as PGnotify structs */
630extern void PQfreemem(void *ptr);
631
632/* Exists for backward compatibility. bjm 2003-03-24 */
633#define PQfreeNotify(ptr) PQfreemem(ptr)
634
635/* Error when no password was given. */
636/* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */
637#define PQnoPasswordSupplied "fe_sendauth: no password supplied\n"
638
639/* Create and manipulate PGresults */
641extern PGresult *PQcopyResult(const PGresult *src, int flags);
642extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs);
643extern void *PQresultAlloc(PGresult *res, size_t nBytes);
644extern size_t PQresultMemorySize(const PGresult *res);
645extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len);
646
647/* Quoting strings before inclusion in queries. */
648extern size_t PQescapeStringConn(PGconn *conn,
649 char *to, const char *from, size_t length,
650 int *error);
651extern char *PQescapeLiteral(PGconn *conn, const char *str, size_t len);
652extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len);
653extern unsigned char *PQescapeByteaConn(PGconn *conn,
654 const unsigned char *from, size_t from_length,
655 size_t *to_length);
656extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
657 size_t *retbuflen);
658
659/* These forms are deprecated! */
660extern size_t PQescapeString(char *to, const char *from, size_t length);
661extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length,
662 size_t *to_length);
663
664
665
666/* === in fe-print.c === */
667
668extern void PQprint(FILE *fout, /* output stream */
669 const PGresult *res,
670 const PQprintOpt *po); /* option structure */
671
672/*
673 * really old printing routines
674 */
675extern void PQdisplayTuples(const PGresult *res,
676 FILE *fp, /* where to send the output */
677 int fillAlign, /* pad the fields with spaces */
678 const char *fieldSep, /* field separator */
679 int printHeader, /* display headers? */
680 int quiet);
681
682extern void PQprintTuples(const PGresult *res,
683 FILE *fout, /* output stream */
684 int PrintAttNames, /* print attribute names */
685 int TerseOutput, /* delimiter bars */
686 int colWidth); /* width of column, if 0, use
687 * variable width */
688
689
690/* === in fe-lobj.c === */
691
692/* Large-object access routines */
693extern int lo_open(PGconn *conn, Oid lobjId, int mode);
694extern int lo_close(PGconn *conn, int fd);
695extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
696extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
697extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
698extern int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence);
699extern Oid lo_creat(PGconn *conn, int mode);
700extern Oid lo_create(PGconn *conn, Oid lobjId);
701extern int lo_tell(PGconn *conn, int fd);
702extern int64_t lo_tell64(PGconn *conn, int fd);
703extern int lo_truncate(PGconn *conn, int fd, size_t len);
704extern int lo_truncate64(PGconn *conn, int fd, int64_t len);
705extern int lo_unlink(PGconn *conn, Oid lobjId);
706extern Oid lo_import(PGconn *conn, const char *filename);
707extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId);
708extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
709
710/* === in fe-misc.c === */
711
712/* Get the version of the libpq library in use */
713extern int PQlibVersion(void);
714
715/* Poll a socket for reading and/or writing with an optional timeout */
716extern int PQsocketPoll(int sock, int forRead, int forWrite,
718
719/* Get current time in the form PQsocketPoll wants */
721
722/* Determine length of multibyte encoded char at *s */
723extern int PQmblen(const char *s, int encoding);
724
725/* Same, but not more than the distance to the end of string s */
726extern int PQmblenBounded(const char *s, int encoding);
727
728/* Determine display length of multibyte encoded char at *s */
729extern int PQdsplen(const char *s, int encoding);
730
731/* Get encoding id from environment variable PGCLIENTENCODING */
732extern int PQenv2encoding(void);
733
734/* === in fe-auth.c === */
735
737{
738 const char *verification_uri; /* verification URI to visit */
739 const char *user_code; /* user code to enter */
740 const char *verification_uri_complete; /* optional combination of URI and
741 * code, or NULL */
742 int expires_in; /* seconds until user code expires */
744
745/* for PGoauthBearerRequest.async() */
746#ifdef _WIN32
747#define SOCKTYPE uintptr_t /* avoids depending on winsock2.h for SOCKET */
748#else
749#define SOCKTYPE int
750#endif
751
753{
754 /* Hook inputs (constant across all calls) */
755 const char *openid_configuration; /* OIDC discovery URI */
756 const char *scope; /* required scope(s), or NULL */
757
758 /* Hook outputs */
759
760 /*---------
761 * Callback implementing a custom asynchronous OAuth flow.
762 *
763 * The callback may return
764 * - PGRES_POLLING_READING/WRITING, to indicate that a socket descriptor
765 * has been stored in *altsock and libpq should wait until it is
766 * readable or writable before calling back;
767 * - PGRES_POLLING_OK, to indicate that the flow is complete and
768 * request->token has been set; or
769 * - PGRES_POLLING_FAILED, to indicate that token retrieval has failed.
770 *
771 * This callback is optional. If the token can be obtained without
772 * blocking during the original call to the PQAUTHDATA_OAUTH_BEARER_TOKEN
773 * hook, it may be returned directly, but one of request->async or
774 * request->token must be set by the hook.
775 */
777 struct PGoauthBearerRequest *request,
778 SOCKTYPE * altsock);
779
780 /*
781 * Callback to clean up custom allocations. A hook implementation may use
782 * this to free request->token and any resources in request->user.
783 *
784 * This is technically optional, but highly recommended, because there is
785 * no other indication as to when it is safe to free the token.
786 */
787 void (*cleanup) (PGconn *conn, struct PGoauthBearerRequest *request);
788
789 /*
790 * The hook should set this to the Bearer token contents for the
791 * connection, once the flow is completed. The token contents must remain
792 * available to libpq until the hook's cleanup callback is called.
793 */
794 char *token;
795
796 /*
797 * Hook-defined data. libpq will not modify this pointer across calls to
798 * the async callback, so it can be used to keep track of
799 * application-specific state. Resources allocated here should be freed by
800 * the cleanup callback.
801 */
802 void *user;
804
805#undef SOCKTYPE
806
807extern char *PQencryptPassword(const char *passwd, const char *user);
808extern char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm);
809extern PGresult *PQchangePassword(PGconn *conn, const char *user, const char *passwd);
810
812extern void PQsetAuthDataHook(PQauthDataHook_type hook);
815
816/* === in encnames.c === */
817
818extern int pg_char_to_encoding(const char *name);
819extern const char *pg_encoding_to_char(int encoding);
821
822/* === in fe-secure-openssl.c === */
823
824/* Support for overriding sslpassword handling with a callback */
825typedef int (*PQsslKeyPassHook_OpenSSL_type) (char *buf, int size, PGconn *conn);
828extern int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn);
829
830#ifdef __cplusplus
831}
832#endif
833
834#endif /* LIBPQ_FE_H */
static Datum values[MAXATTR]
Definition: bootstrap.c:151
static PGcancel *volatile cancelConn
Definition: cancel.c:43
int errmsg(const char *fmt,...)
Definition: elog.c:1071
const char * str
#define stmt
Definition: indent_codes.h:59
#define bufsize
Definition: indent_globs.h:36
static struct @165 value
static const JsonPathKeyword keywords[]
ConnStatusType
Definition: libpq-fe.h:83
@ CONNECTION_CONSUME
Definition: libpq-fe.h:102
@ CONNECTION_AUTHENTICATING
Definition: libpq-fe.h:109
@ CONNECTION_CHECK_STANDBY
Definition: libpq-fe.h:106
@ CONNECTION_STARTED
Definition: libpq-fe.h:92
@ CONNECTION_AWAITING_RESPONSE
Definition: libpq-fe.h:94
@ CONNECTION_MADE
Definition: libpq-fe.h:93
@ CONNECTION_CHECK_WRITABLE
Definition: libpq-fe.h:101
@ CONNECTION_BAD
Definition: libpq-fe.h:85
@ CONNECTION_OK
Definition: libpq-fe.h:84
@ CONNECTION_GSS_STARTUP
Definition: libpq-fe.h:103
@ CONNECTION_ALLOCATED
Definition: libpq-fe.h:107
@ CONNECTION_SSL_STARTUP
Definition: libpq-fe.h:99
@ CONNECTION_AUTH_OK
Definition: libpq-fe.h:96
@ CONNECTION_CHECK_TARGET
Definition: libpq-fe.h:104
@ CONNECTION_NEEDED
Definition: libpq-fe.h:100
@ CONNECTION_SETENV
Definition: libpq-fe.h:98
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:7609
char * PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm)
Definition: fe-auth.c:1406
int PQprotocolVersion(const PGconn *conn)
Definition: fe-connect.c:7589
char pqbool
Definition: libpq-fe.h:248
int PQresetStart(PGconn *conn)
Definition: fe-connect.c:5337
int PQsendQueryParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
Definition: fe-exec.c:1492
int PQgetlength(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3887
int PQsetSingleRowMode(PGconn *conn)
Definition: fe-exec.c:1948
void PQsetAuthDataHook(PQauthDataHook_type hook)
Definition: fe-auth.c:1595
char * PQoptions(const PGconn *conn)
Definition: fe-connect.c:7548
int PQbinaryTuples(const PGresult *res)
Definition: fe-exec.c:3497
int PQflush(PGconn *conn)
Definition: fe-exec.c:4000
PGresult * PQcopyResult(const PGresult *src, int flags)
Definition: fe-exec.c:318
void PQfreemem(void *ptr)
Definition: fe-exec.c:4032
void PQdisplayTuples(const PGresult *res, FILE *fp, int fillAlign, const char *fieldSep, int printHeader, int quiet)
Definition: fe-print.c:574
int PQgetline(PGconn *conn, char *buffer, int length)
Definition: fe-exec.c:2854
int(* PQauthDataHook_type)(PGauthData type, PGconn *conn, void *data)
Definition: libpq-fe.h:811
ExecStatusType
Definition: libpq-fe.h:123
@ PGRES_COPY_IN
Definition: libpq-fe.h:132
@ PGRES_COPY_BOTH
Definition: libpq-fe.h:137
@ PGRES_COMMAND_OK
Definition: libpq-fe.h:125
@ PGRES_TUPLES_CHUNK
Definition: libpq-fe.h:142
@ PGRES_FATAL_ERROR
Definition: libpq-fe.h:136
@ PGRES_SINGLE_TUPLE
Definition: libpq-fe.h:138
@ PGRES_COPY_OUT
Definition: libpq-fe.h:131
@ PGRES_EMPTY_QUERY
Definition: libpq-fe.h:124
@ PGRES_PIPELINE_SYNC
Definition: libpq-fe.h:139
@ PGRES_BAD_RESPONSE
Definition: libpq-fe.h:133
@ PGRES_PIPELINE_ABORTED
Definition: libpq-fe.h:140
@ PGRES_NONFATAL_ERROR
Definition: libpq-fe.h:135
@ PGRES_TUPLES_OK
Definition: libpq-fe.h:128
char * PQdb(const PGconn *conn)
Definition: fe-connect.c:7447
void PQinitSSL(int do_init)
Definition: fe-secure.c:117
Oid PQftype(const PGresult *res, int field_num)
Definition: fe-exec.c:3719
PGresult * PQchangePassword(PGconn *conn, const char *user, const char *passwd)
Definition: fe-auth.c:1531
void(* pgthreadlock_t)(int acquire)
Definition: libpq-fe.h:472
int lo_tell(PGconn *conn, int fd)
Definition: fe-lobj.c:515
void * PQgetssl(PGconn *conn)
char * PQresultVerboseErrorMessage(const PGresult *res, PGVerbosity verbosity, PGContextVisibility show_context)
Definition: fe-exec.c:3435
struct PGoauthBearerRequest PGoauthBearerRequest
PGresult * PQdescribePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2455
PGresult * PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
Definition: fe-exec.c:2276
int PQexitPipelineMode(PGconn *conn)
Definition: fe-exec.c:3073
#define SOCKTYPE
Definition: libpq-fe.h:749
PGresult * PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
Definition: fe-exec.c:2323
int PQsendClosePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2569
PGPing
Definition: libpq-fe.h:175
@ PQPING_OK
Definition: libpq-fe.h:176
@ PQPING_REJECT
Definition: libpq-fe.h:177
@ PQPING_NO_RESPONSE
Definition: libpq-fe.h:178
@ PQPING_NO_ATTEMPT
Definition: libpq-fe.h:179
PGcancel * PQgetCancel(PGconn *conn)
Definition: fe-cancel.c:367
int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs)
Definition: fe-exec.c:249
PGContextVisibility
Definition: libpq-fe.h:163
@ PQSHOW_CONTEXT_NEVER
Definition: libpq-fe.h:164
@ PQSHOW_CONTEXT_ALWAYS
Definition: libpq-fe.h:166
@ PQSHOW_CONTEXT_ERRORS
Definition: libpq-fe.h:165
void PQcancelReset(PGcancelConn *cancelConn)
Definition: fe-cancel.c:336
int lo_close(PGconn *conn, int fd)
Definition: fe-lobj.c:96
struct _PQconninfoOption PQconninfoOption
unsigned char * PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
Definition: fe-exec.c:4553
int PQenv2encoding(void)
Definition: fe-misc.c:1262
const char * pg_encoding_to_char(int encoding)
Definition: encnames.c:587
PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void)
void * PQsslStruct(PGconn *conn, const char *struct_name)
int PQfullProtocolVersion(const PGconn *conn)
Definition: fe-connect.c:7599
void PQreset(PGconn *conn)
Definition: fe-connect.c:5304
int PQenterPipelineMode(PGconn *conn)
Definition: fe-exec.c:3042
int PQsocketPoll(int sock, int forRead, int forWrite, pg_usec_time_t end_time)
Definition: fe-misc.c:1115
int lo_truncate64(PGconn *conn, int fd, int64_t len)
Definition: fe-lobj.c:195
size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error)
Definition: fe-exec.c:4176
void PQtrace(PGconn *conn, FILE *debug_port)
Definition: fe-trace.c:35
char * PQport(const PGconn *conn)
Definition: fe-connect.c:7524
PGresult * PQclosePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2521
PGTransactionStatusType PQtransactionStatus(const PGconn *conn)
Definition: fe-connect.c:7564
PGcancelConn * PQcancelCreate(PGconn *conn)
Definition: fe-cancel.c:68
PGTransactionStatusType
Definition: libpq-fe.h:146
@ PQTRANS_INTRANS
Definition: libpq-fe.h:149
@ PQTRANS_IDLE
Definition: libpq-fe.h:147
@ PQTRANS_ACTIVE
Definition: libpq-fe.h:148
@ PQTRANS_UNKNOWN
Definition: libpq-fe.h:151
@ PQTRANS_INERROR
Definition: libpq-fe.h:150
PQauthDataHook_type PQgetAuthDataHook(void)
Definition: fe-auth.c:1589
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3876
void * PQgetgssctx(PGconn *conn)
PGresult * PQclosePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2539
PGresult * PQgetResult(PGconn *conn)
Definition: fe-exec.c:2062
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:3411
Oid PQparamtype(const PGresult *res, int param_num)
Definition: fe-exec.c:3926
PGconn * PQconnectdb(const char *conninfo)
Definition: fe-connect.c:813
char * PQhost(const PGconn *conn)
Definition: fe-connect.c:7488
int PQnparams(const PGresult *res)
Definition: fe-exec.c:3915
int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn)
int pg_char_to_encoding(const char *name)
Definition: encnames.c:549
void PQprintTuples(const PGresult *res, FILE *fout, int PrintAttNames, int TerseOutput, int colWidth)
Definition: fe-print.c:671
void PQclear(PGresult *res)
Definition: fe-exec.c:721
int PQsendClosePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2556
char * PQservice(const PGconn *conn)
Definition: fe-connect.c:7455
char * PQcmdTuples(PGresult *res)
Definition: fe-exec.c:3822
struct _PQprintOpt PQprintOpt
int PQconnectionUsedPassword(const PGconn *conn)
Definition: fe-connect.c:7687
PQconninfoOption * PQconninfo(PGconn *conn)
Definition: fe-connect.c:7390
int PQfformat(const PGresult *res, int field_num)
Definition: fe-exec.c:3708
void(* PQnoticeReceiver)(void *arg, const PGresult *res)
Definition: libpq-fe.h:244
int PQlibVersion(void)
Definition: fe-misc.c:63
int64_t pg_usec_time_t
Definition: libpq-fe.h:241
void(* PQnoticeProcessor)(void *arg, const char *message)
Definition: libpq-fe.h:245
int PQendcopy(PGconn *conn)
Definition: fe-exec.c:2949
int PQgssEncInUse(PGconn *conn)
PostgresPollingStatusType PQconnectPoll(PGconn *conn)
Definition: fe-connect.c:2905
int PQdefaultAuthDataHook(PGauthData type, PGconn *conn, void *data)
Definition: fe-auth.c:1601
int PQputCopyEnd(PGconn *conn, const char *errormsg)
Definition: fe-exec.c:2749
void PQconninfoFree(PQconninfoOption *connOptions)
Definition: fe-connect.c:7434
Oid lo_creat(PGconn *conn, int mode)
Definition: fe-lobj.c:438
int PQsendPipelineSync(PGconn *conn)
Definition: fe-exec.c:3282
int(* PQsslKeyPassHook_OpenSSL_type)(char *buf, int size, PGconn *conn)
Definition: libpq-fe.h:825
int lo_read(PGconn *conn, int fd, char *buf, size_t len)
Definition: fe-lobj.c:245
int lo_lseek(PGconn *conn, int fd, int offset, int whence)
Definition: fe-lobj.c:344
int PQntuples(const PGresult *res)
Definition: fe-exec.c:3481
int PQputnbytes(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2928
void PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
Definition: fe-print.c:68
int pg_valid_server_encoding_id(int encoding)
Definition: encnames.c:513
int PQmblen(const char *s, int encoding)
Definition: fe-misc.c:1233
int PQputline(PGconn *conn, const char *string)
Definition: fe-exec.c:2918
int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize)
Definition: fe-exec.c:2901
int lo_open(PGconn *conn, Oid lobjId, int mode)
Definition: fe-lobj.c:57
PostgresPollingStatusType
Definition: libpq-fe.h:114
@ PGRES_POLLING_ACTIVE
Definition: libpq-fe.h:119
@ PGRES_POLLING_OK
Definition: libpq-fe.h:118
@ PGRES_POLLING_READING
Definition: libpq-fe.h:116
@ PGRES_POLLING_WRITING
Definition: libpq-fe.h:117
@ PGRES_POLLING_FAILED
Definition: libpq-fe.h:115
char * PQtty(const PGconn *conn)
Definition: fe-connect.c:7540
int PQputCopyData(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2695
PQconninfoOption * PQconninfoParse(const char *conninfo, char **errmsg)
Definition: fe-connect.c:6150
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
Definition: fe-connect.c:7574
PGresult * PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
Definition: fe-exec.c:159
ConnStatusType PQcancelStatus(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:301
int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence)
Definition: fe-lobj.c:385
PGresult * PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
Definition: fe-exec.c:2306
int64_t lo_tell64(PGconn *conn, int fd)
Definition: fe-lobj.c:548
int lo_write(PGconn *conn, int fd, const char *buf, size_t len)
Definition: fe-lobj.c:295
int PQisthreadsafe(void)
Definition: fe-exec.c:3992
int PQconnectionNeedsPassword(const PGconn *conn)
Definition: fe-connect.c:7672
char * PQresultErrorMessage(const PGresult *res)
Definition: fe-exec.c:3427
char * PQencryptPassword(const char *passwd, const char *user)
Definition: fe-auth.c:1363
char * PQpass(const PGconn *conn)
Definition: fe-connect.c:7471
void PQinitOpenSSL(int do_ssl, int do_crypto)
Definition: fe-secure.c:129
int PQcancelBlocking(PGcancelConn *cancelConn)
Definition: fe-cancel.c:189
int lo_truncate(PGconn *conn, int fd, size_t len)
Definition: fe-lobj.c:131
int PQsendDescribePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2491
char * PQfname(const PGresult *res, int field_num)
Definition: fe-exec.c:3567
Oid lo_create(PGconn *conn, Oid lobjId)
Definition: fe-lobj.c:474
int64_t pg_int64
Definition: libpq-fe.h:238
PostgresPollingStatusType PQresetPoll(PGconn *conn)
Definition: fe-connect.c:5356
int PQsslInUse(PGconn *conn)
Definition: fe-secure.c:103
int PQconnectionUsedGSSAPI(const PGconn *conn)
Definition: fe-connect.c:7698
size_t PQescapeString(char *to, const char *from, size_t length)
Definition: fe-exec.c:4198
int PQconsumeInput(PGconn *conn)
Definition: fe-exec.c:1984
int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
Definition: fe-cancel.c:530
PGauthData
Definition: libpq-fe.h:193
@ PQAUTHDATA_PROMPT_OAUTH_DEVICE
Definition: libpq-fe.h:194
@ PQAUTHDATA_OAUTH_BEARER_TOKEN
Definition: libpq-fe.h:196
struct pgNotify PGnotify
ConnStatusType PQstatus(const PGconn *conn)
Definition: fe-connect.c:7556
PGconn * PQconnectStart(const char *conninfo)
Definition: fe-connect.c:941
Oid PQftable(const PGresult *res, int field_num)
Definition: fe-exec.c:3686
int PQfnumber(const PGresult *res, const char *field_name)
Definition: fe-exec.c:3589
unsigned char * PQescapeBytea(const unsigned char *from, size_t from_length, size_t *to_length)
Definition: fe-exec.c:4528
int PQsetnonblocking(PGconn *conn, int arg)
Definition: fe-exec.c:3944
int PQclientEncoding(const PGconn *conn)
Definition: fe-connect.c:7709
PGconn * PQconnectStartParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:860
char * PQescapeLiteral(PGconn *conn, const char *str, size_t len)
Definition: fe-exec.c:4363
void PQfinish(PGconn *conn)
Definition: fe-connect.c:5290
PGresult * PQfn(PGconn *conn, int fnid, int *result_buf, int *result_len, int result_is_int, const PQArgBlock *args, int nargs)
Definition: fe-exec.c:2980
PGPing PQping(const char *conninfo)
Definition: fe-connect.c:829
int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
Definition: fe-exec.c:1536
PGresult * PQdescribePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2474
int PQfmod(const PGresult *res, int field_num)
Definition: fe-exec.c:3741
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
Definition: fe-connect.c:7771
PGpipelineStatus
Definition: libpq-fe.h:186
@ PQ_PIPELINE_OFF
Definition: libpq-fe.h:187
@ PQ_PIPELINE_ABORTED
Definition: libpq-fe.h:189
@ PQ_PIPELINE_ON
Definition: libpq-fe.h:188
int PQdsplen(const char *s, int encoding)
Definition: fe-misc.c:1253
int PQgetisnull(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3901
int PQftablecol(const PGresult *res, int field_num)
Definition: fe-exec.c:3697
int PQsetChunkedRowsMode(PGconn *conn, int chunkSize)
Definition: fe-exec.c:1965
const char * PQsslAttribute(PGconn *conn, const char *attribute_name)
char * PQresultErrorField(const PGresult *res, int fieldcode)
Definition: fe-exec.c:3466
int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
Definition: fe-exec.c:452
int PQsendQuery(PGconn *conn, const char *query)
Definition: fe-exec.c:1416
char * PQcmdStatus(PGresult *res)
Definition: fe-exec.c:3752
int PQpipelineSync(PGconn *conn)
Definition: fe-exec.c:3272
PostgresPollingStatusType PQcancelPoll(PGcancelConn *cancelConn)
Definition: fe-cancel.c:225
char * PQoidStatus(const PGresult *res)
Definition: fe-exec.c:3765
PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, PQnoticeReceiver proc, void *arg)
Definition: fe-connect.c:7783
int PQsendDescribePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2504
void PQcancelFinish(PGcancelConn *cancelConn)
Definition: fe-cancel.c:352
PGconn * PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, const char *dbName, const char *login, const char *pwd)
Definition: fe-connect.c:2228
struct _PGpromptOAuthDevice PGpromptOAuthDevice
void PQsetTraceFlags(PGconn *conn, int flags)
Definition: fe-trace.c:64
char * PQhostaddr(const PGconn *conn)
Definition: fe-connect.c:7511
char * PQresStatus(ExecStatusType status)
Definition: fe-exec.c:3419
size_t PQresultMemorySize(const PGresult *res)
Definition: fe-exec.c:663
int PQbackendPID(const PGconn *conn)
Definition: fe-connect.c:7655
void * PQresultAlloc(PGresult *res, size_t nBytes)
Definition: fe-exec.c:543
PQconninfoOption * PQconndefaults(void)
Definition: fe-connect.c:2190
int PQisBusy(PGconn *conn)
Definition: fe-exec.c:2031
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:2262
pg_usec_time_t PQgetCurrentTimeUSec(void)
Definition: fe-misc.c:1209
unsigned char * PQescapeByteaConn(PGconn *conn, const unsigned char *from, size_t from_length, size_t *to_length)
Definition: fe-exec.c:4512
int PQsendQueryPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
Definition: fe-exec.c:1633
char * PQescapeIdentifier(PGconn *conn, const char *str, size_t len)
Definition: fe-exec.c:4369
PGVerbosity
Definition: libpq-fe.h:155
@ PQERRORS_VERBOSE
Definition: libpq-fe.h:158
@ PQERRORS_DEFAULT
Definition: libpq-fe.h:157
@ PQERRORS_TERSE
Definition: libpq-fe.h:156
@ PQERRORS_SQLSTATE
Definition: libpq-fe.h:159
int PQsendFlushRequest(PGconn *conn)
Definition: fe-exec.c:3371
int PQrequestCancel(PGconn *conn)
Definition: fe-cancel.c:725
void PQfreeCancel(PGcancel *cancel)
Definition: fe-cancel.c:484
char * PQuser(const PGconn *conn)
Definition: fe-connect.c:7463
int PQcancelSocket(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:312
PGpipelineStatus PQpipelineStatus(const PGconn *conn)
Definition: fe-connect.c:7663
int lo_unlink(PGconn *conn, Oid lobjId)
Definition: fe-lobj.c:589
int PQisnonblocking(const PGconn *conn)
Definition: fe-exec.c:3983
void PQuntrace(PGconn *conn)
Definition: fe-trace.c:49
PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity)
Definition: fe-connect.c:7759
PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg)
Definition: fe-connect.c:7800
char * PQcancelErrorMessage(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:324
Oid lo_import(PGconn *conn, const char *filename)
Definition: fe-lobj.c:626
Oid PQoidValue(const PGresult *res)
Definition: fe-exec.c:3793
int PQmblenBounded(const char *s, int encoding)
Definition: fe-misc.c:1243
int lo_export(PGconn *conn, Oid lobjId, const char *filename)
Definition: fe-lobj.c:748
const char *const * PQsslAttributeNames(PGconn *conn)
int PQcancelStart(PGcancelConn *cancelConn)
Definition: fe-cancel.c:203
int PQnfields(const PGresult *res)
Definition: fe-exec.c:3489
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:7619
Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId)
Definition: fe-lobj.c:641
void PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook)
PGPing PQpingParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:776
int PQsocket(const PGconn *conn)
Definition: fe-connect.c:7645
int PQfsize(const PGresult *res, int field_num)
Definition: fe-exec.c:3730
PGnotify * PQnotifies(PGconn *conn)
Definition: fe-exec.c:2667
int PQsetClientEncoding(PGconn *conn, const char *encoding)
Definition: fe-connect.c:7717
PGconn * PQconnectdbParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:758
struct pgresAttDesc PGresAttDesc
pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler)
Definition: fe-connect.c:8277
int PQgetCopyData(PGconn *conn, char **buffer, int async)
Definition: fe-exec.c:2816
void * arg
static PgChecksumMode mode
Definition: pg_checksums.c:55
const void size_t len
const void * data
static void do_init(void)
Definition: pg_ctl.c:902
int32 encoding
Definition: pg_database.h:41
static char * filename
Definition: pg_dumpall.c:123
static char * user
Definition: pg_regress.c:119
static char * buf
Definition: pg_test_fsync.c:72
static int64 end_time
Definition: pgbench.c:176
static const char * pghost
Definition: pgbench.c:295
static const char * pgport
Definition: pgbench.c:296
static const char * dbName
Definition: pgbench.c:298
unsigned int Oid
Definition: postgres_ext.h:30
static int fd(const char *x, int i)
Definition: preproc-init.c:105
static void error(void)
Definition: sql-dyntest.c:147
PGconn * conn
Definition: streamutil.c:52
const char * scope
Definition: libpq-fe.h:756
void(* cleanup)(PGconn *conn, struct PGoauthBearerRequest *request)
Definition: libpq-fe.h:787
const char * openid_configuration
Definition: libpq-fe.h:755
PostgresPollingStatusType(* async)(PGconn *conn, struct PGoauthBearerRequest *request, SOCKTYPE *altsock)
Definition: libpq-fe.h:776
int isint
Definition: libpq-fe.h:296
int * ptr
Definition: libpq-fe.h:299
int integer
Definition: libpq-fe.h:300
const char * verification_uri_complete
Definition: libpq-fe.h:740
const char * verification_uri
Definition: libpq-fe.h:738
const char * user_code
Definition: libpq-fe.h:739
pqbool align
Definition: libpq-fe.h:253
pqbool pager
Definition: libpq-fe.h:257
pqbool standard
Definition: libpq-fe.h:254
pqbool html3
Definition: libpq-fe.h:255
char * caption
Definition: libpq-fe.h:260
pqbool header
Definition: libpq-fe.h:252
pqbool expanded
Definition: libpq-fe.h:256
char * fieldSep
Definition: libpq-fe.h:258
char ** fieldName
Definition: libpq-fe.h:261
char * tableOpt
Definition: libpq-fe.h:259
struct pgNotify * next
Definition: libpq-fe.h:234
int be_pid
Definition: libpq-fe.h:231
char * relname
Definition: libpq-fe.h:230
char * extra
Definition: libpq-fe.h:232
char * name
Definition: libpq-fe.h:310
int columnid
Definition: libpq-fe.h:312
int atttypmod
Definition: libpq-fe.h:316
const char * type
const char * name