PostgreSQL Source Code git master
pg_backup_db.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * pg_backup_db.c
4 *
5 * Implements the basic DB functions used by the archiver.
6 *
7 * IDENTIFICATION
8 * src/bin/pg_dump/pg_backup_db.c
9 *
10 *-------------------------------------------------------------------------
11 */
12#include "postgres_fe.h"
13
14#include <unistd.h>
15#include <ctype.h>
16#ifdef HAVE_TERMIOS_H
17#include <termios.h>
18#endif
19
20#include "common/connect.h"
21#include "common/string.h"
22#include "parallel.h"
23#include "pg_backup_archiver.h"
24#include "pg_backup_db.h"
25#include "pg_backup_utils.h"
26
28static void notice_processor(void *arg, const char *message);
29
30static void
32{
33 const char *remoteversion_str;
34 int remoteversion;
36
37 remoteversion_str = PQparameterStatus(AH->connection, "server_version");
38 remoteversion = PQserverVersion(AH->connection);
39 if (remoteversion == 0 || !remoteversion_str)
40 pg_fatal("could not get \"server_version\" from libpq");
41
42 AH->public.remoteVersionStr = pg_strdup(remoteversion_str);
43 AH->public.remoteVersion = remoteversion;
44 if (!AH->archiveRemoteVersion)
46
47 if (remoteversion != PG_VERSION_NUM
48 && (remoteversion < AH->public.minRemoteVersion ||
49 remoteversion > AH->public.maxRemoteVersion))
50 {
51 pg_log_error("aborting because of server version mismatch");
52 pg_log_error_detail("server version: %s; %s version: %s",
53 remoteversion_str, progname, PG_VERSION);
54 exit(1);
55 }
56
57 /*
58 * Check if server is in recovery mode, which means we are on a hot
59 * standby.
60 */
62 "SELECT pg_catalog.pg_is_in_recovery()");
63 AH->public.isStandby = (strcmp(PQgetvalue(res, 0, 0), "t") == 0);
64 PQclear(res);
65}
66
67/*
68 * Reconnect to the server. If dbname is not NULL, use that database,
69 * else the one associated with the archive handle.
70 */
71void
73{
74 PGconn *oldConn = AH->connection;
75 RestoreOptions *ropt = AH->public.ropt;
76
77 /*
78 * Save the dbname, if given, in override_dbname so that it will also
79 * affect any later reconnection attempt.
80 */
81 if (dbname)
83
84 /*
85 * Note: we want to establish the new connection, and in particular update
86 * ArchiveHandle's connCancel, before closing old connection. Otherwise
87 * an ill-timed SIGINT could try to access a dead connection.
88 */
89 AH->connection = NULL; /* dodge error check in ConnectDatabase */
90
91 ConnectDatabase((Archive *) AH, &ropt->cparams, true);
92
93 PQfinish(oldConn);
94}
95
96/*
97 * Make, or remake, a database connection with the given parameters.
98 *
99 * The resulting connection handle is stored in AHX->connection.
100 *
101 * An interactive password prompt is automatically issued if required.
102 * We store the results of that in AHX->savedPassword.
103 * Note: it's not really all that sensible to use a single-entry password
104 * cache if the username keeps changing. In current usage, however, the
105 * username never does change, so one savedPassword is sufficient.
106 */
107void
109 const ConnParams *cparams,
110 bool isReconnect)
111{
112 ArchiveHandle *AH = (ArchiveHandle *) AHX;
113 trivalue prompt_password;
114 char *password;
115 bool new_pass;
116
117 if (AH->connection)
118 pg_fatal("already connected to a database");
119
120 /* Never prompt for a password during a reconnection */
121 prompt_password = isReconnect ? TRI_NO : cparams->promptPassword;
122
124
125 if (prompt_password == TRI_YES && password == NULL)
126 password = simple_prompt("Password: ", false);
127
128 /*
129 * Start the connection. Loop until we have a password if requested by
130 * backend.
131 */
132 do
133 {
134 const char *keywords[8];
135 const char *values[8];
136 int i = 0;
137
138 /*
139 * If dbname is a connstring, its entries can override the other
140 * values obtained from cparams; but in turn, override_dbname can
141 * override the dbname component of it.
142 */
143 keywords[i] = "host";
144 values[i++] = cparams->pghost;
145 keywords[i] = "port";
146 values[i++] = cparams->pgport;
147 keywords[i] = "user";
148 values[i++] = cparams->username;
149 keywords[i] = "password";
150 values[i++] = password;
151 keywords[i] = "dbname";
152 values[i++] = cparams->dbname;
153 if (cparams->override_dbname)
154 {
155 keywords[i] = "dbname";
156 values[i++] = cparams->override_dbname;
157 }
158 keywords[i] = "fallback_application_name";
159 values[i++] = progname;
160 keywords[i] = NULL;
161 values[i++] = NULL;
163
164 new_pass = false;
166
167 if (!AH->connection)
168 pg_fatal("could not connect to database");
169
170 if (PQstatus(AH->connection) == CONNECTION_BAD &&
172 password == NULL &&
173 prompt_password != TRI_NO)
174 {
175 PQfinish(AH->connection);
176 password = simple_prompt("Password: ", false);
177 new_pass = true;
178 }
179 } while (new_pass);
180
181 /* check to see that the backend connection was successfully made */
183 {
184 if (isReconnect)
185 pg_fatal("reconnection failed: %s",
187 else
188 pg_fatal("%s",
190 }
191
192 /* Start strict; later phases may override this. */
195
196 if (password && password != AH->savedPassword)
197 free(password);
198
199 /*
200 * We want to remember connection's actual password, whether or not we got
201 * it by prompting. So we don't just store the password variable.
202 */
204 {
205 free(AH->savedPassword);
207 }
208
209 /* check for version mismatch */
211
213
214 /* arrange for SIGINT to issue a query cancel on this connection */
216}
217
218/*
219 * Close the connection to the database and also cancel off the query if we
220 * have one running.
221 */
222void
224{
225 ArchiveHandle *AH = (ArchiveHandle *) AHX;
226 char errbuf[1];
227
228 if (!AH->connection)
229 return;
230
231 if (AH->connCancel)
232 {
233 /*
234 * If we have an active query, send a cancel before closing, ignoring
235 * any errors. This is of no use for a normal exit, but might be
236 * helpful during pg_fatal().
237 */
239 (void) PQcancel(AH->connCancel, errbuf, sizeof(errbuf));
240
241 /*
242 * Prevent signal handler from sending a cancel after this.
243 */
244 set_archive_cancel_info(AH, NULL);
245 }
246
247 PQfinish(AH->connection);
248 AH->connection = NULL;
249}
250
251PGconn *
253{
254 ArchiveHandle *AH = (ArchiveHandle *) AHX;
255
256 return AH->connection;
257}
258
259static void
260notice_processor(void *arg, const char *message)
261{
262 pg_log_info("%s", message);
263}
264
265/* Like pg_fatal(), but with a complaint about a particular query. */
266static void
267die_on_query_failure(ArchiveHandle *AH, const char *query)
268{
269 pg_log_error("query failed: %s",
271 pg_log_error_detail("Query was: %s", query);
272 exit(1);
273}
274
275void
276ExecuteSqlStatement(Archive *AHX, const char *query)
277{
278 ArchiveHandle *AH = (ArchiveHandle *) AHX;
279 PGresult *res;
280
281 res = PQexec(AH->connection, query);
283 die_on_query_failure(AH, query);
284 PQclear(res);
285}
286
287PGresult *
288ExecuteSqlQuery(Archive *AHX, const char *query, ExecStatusType status)
289{
290 ArchiveHandle *AH = (ArchiveHandle *) AHX;
291 PGresult *res;
292
293 res = PQexec(AH->connection, query);
294 if (PQresultStatus(res) != status)
295 die_on_query_failure(AH, query);
296 return res;
297}
298
299/*
300 * Execute an SQL query and verify that we got exactly one row back.
301 */
302PGresult *
303ExecuteSqlQueryForSingleRow(Archive *fout, const char *query)
304{
305 PGresult *res;
306 int ntups;
307
308 res = ExecuteSqlQuery(fout, query, PGRES_TUPLES_OK);
309
310 /* Expecting a single result only */
311 ntups = PQntuples(res);
312 if (ntups != 1)
313 pg_fatal(ngettext("query returned %d row instead of one: %s",
314 "query returned %d rows instead of one: %s",
315 ntups),
316 ntups, query);
317
318 return res;
319}
320
321/*
322 * Convenience function to send a query.
323 * Monitors result to detect COPY statements
324 */
325static void
326ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc)
327{
328 PGconn *conn = AH->connection;
329 PGresult *res;
330
331#ifdef NOT_USED
332 fprintf(stderr, "Executing: '%s'\n\n", qry);
333#endif
334 res = PQexec(conn, qry);
335
336 switch (PQresultStatus(res))
337 {
338 case PGRES_COMMAND_OK:
339 case PGRES_TUPLES_OK:
341 /* A-OK */
342 break;
343 case PGRES_COPY_IN:
344 /* Assume this is an expected result */
345 AH->pgCopyIn = true;
346 break;
347 default:
348 /* trouble */
349 warn_or_exit_horribly(AH, "%s: %sCommand was: %s",
350 desc, PQerrorMessage(conn), qry);
351 break;
352 }
353
354 PQclear(res);
355}
356
357
358/*
359 * Process non-COPY table data (that is, INSERT commands).
360 *
361 * The commands have been run together as one long string for compressibility,
362 * and we are receiving them in bufferloads with arbitrary boundaries, so we
363 * have to locate command boundaries and save partial commands across calls.
364 * All state must be kept in AH->sqlparse, not in local variables of this
365 * routine. We assume that AH->sqlparse was filled with zeroes when created.
366 *
367 * We have to lex the data to the extent of identifying literals and quoted
368 * identifiers, so that we can recognize statement-terminating semicolons.
369 * We assume that INSERT data will not contain SQL comments, E'' literals,
370 * or dollar-quoted strings, so this is much simpler than a full SQL lexer.
371 *
372 * Note: when restoring from a pre-9.0 dump file, this code is also used to
373 * process BLOB COMMENTS data, which has the same problem of containing
374 * multiple SQL commands that might be split across bufferloads. Fortunately,
375 * that data won't contain anything complicated to lex either.
376 */
377static void
378ExecuteSimpleCommands(ArchiveHandle *AH, const char *buf, size_t bufLen)
379{
380 const char *qry = buf;
381 const char *eos = buf + bufLen;
382
383 /* initialize command buffer if first time through */
384 if (AH->sqlparse.curCmd == NULL)
386
387 for (; qry < eos; qry++)
388 {
389 char ch = *qry;
390
391 /* For neatness, we skip any newlines between commands */
392 if (!(ch == '\n' && AH->sqlparse.curCmd->len == 0))
394
395 switch (AH->sqlparse.state)
396 {
397 case SQL_SCAN: /* Default state == 0, set in _allocAH */
398 if (ch == ';')
399 {
400 /*
401 * We've found the end of a statement. Send it and reset
402 * the buffer.
403 */
405 "could not execute query");
407 }
408 else if (ch == '\'')
409 {
411 AH->sqlparse.backSlash = false;
412 }
413 else if (ch == '"')
414 {
416 }
417 break;
418
420 /* We needn't handle '' specially */
421 if (ch == '\'' && !AH->sqlparse.backSlash)
422 AH->sqlparse.state = SQL_SCAN;
423 else if (ch == '\\' && !AH->public.std_strings)
425 else
426 AH->sqlparse.backSlash = false;
427 break;
428
430 /* We needn't handle "" specially */
431 if (ch == '"')
432 AH->sqlparse.state = SQL_SCAN;
433 break;
434 }
435 }
436}
437
438
439/*
440 * Implement ahwrite() for direct-to-DB restore
441 */
442int
443ExecuteSqlCommandBuf(Archive *AHX, const char *buf, size_t bufLen)
444{
445 ArchiveHandle *AH = (ArchiveHandle *) AHX;
446
447 if (AH->outputKind == OUTPUT_COPYDATA)
448 {
449 /*
450 * COPY data.
451 *
452 * We drop the data on the floor if libpq has failed to enter COPY
453 * mode; this allows us to behave reasonably when trying to continue
454 * after an error in a COPY command.
455 */
456 if (AH->pgCopyIn &&
457 PQputCopyData(AH->connection, buf, bufLen) <= 0)
458 pg_fatal("error returned by PQputCopyData: %s",
460 }
461 else if (AH->outputKind == OUTPUT_OTHERDATA)
462 {
463 /*
464 * Table data expressed as INSERT commands; or, in old dump files,
465 * BLOB COMMENTS data (which is expressed as COMMENT ON commands).
466 */
467 ExecuteSimpleCommands(AH, buf, bufLen);
468 }
469 else
470 {
471 /*
472 * General SQL commands; we assume that commands will not be split
473 * across calls.
474 *
475 * In most cases the data passed to us will be a null-terminated
476 * string, but if it's not, we have to add a trailing null.
477 */
478 if (buf[bufLen] == '\0')
479 ExecuteSqlCommand(AH, buf, "could not execute query");
480 else
481 {
482 char *str = (char *) pg_malloc(bufLen + 1);
483
484 memcpy(str, buf, bufLen);
485 str[bufLen] = '\0';
486 ExecuteSqlCommand(AH, str, "could not execute query");
487 free(str);
488 }
489 }
490
491 return bufLen;
492}
493
494/*
495 * Terminate a COPY operation during direct-to-DB restore
496 */
497void
498EndDBCopyMode(Archive *AHX, const char *tocEntryTag)
499{
500 ArchiveHandle *AH = (ArchiveHandle *) AHX;
501
502 if (AH->pgCopyIn)
503 {
504 PGresult *res;
505
506 if (PQputCopyEnd(AH->connection, NULL) <= 0)
507 pg_fatal("error returned by PQputCopyEnd: %s",
509
510 /* Check command status and return to normal libpq state */
513 warn_or_exit_horribly(AH, "COPY failed for table \"%s\": %s",
514 tocEntryTag, PQerrorMessage(AH->connection));
515 PQclear(res);
516
517 /* Do this to ensure we've pumped libpq back to idle state */
518 if (PQgetResult(AH->connection) != NULL)
519 pg_log_warning("unexpected extra results during COPY of table \"%s\"",
520 tocEntryTag);
521
522 AH->pgCopyIn = false;
523 }
524}
525
526void
528{
529 ArchiveHandle *AH = (ArchiveHandle *) AHX;
530
531 ExecuteSqlCommand(AH, "BEGIN", "could not start database transaction");
532}
533
534void
536{
537 ArchiveHandle *AH = (ArchiveHandle *) AHX;
538
539 ExecuteSqlCommand(AH, "COMMIT", "could not commit database transaction");
540}
541
542/*
543 * Issue per-blob commands for the large object(s) listed in the TocEntry
544 *
545 * The TocEntry's defn string is assumed to consist of large object OIDs,
546 * one per line. Wrap these in the given SQL command fragments and issue
547 * the commands. (cmdEnd need not include a semicolon.)
548 */
549void
551 const char *cmdBegin, const char *cmdEnd)
552{
553 /* Make a writable copy of the command string */
554 char *buf = pg_strdup(te->defn);
555 RestoreOptions *ropt = AH->public.ropt;
556 char *st;
557 char *en;
558
559 st = buf;
560 while ((en = strchr(st, '\n')) != NULL)
561 {
562 *en++ = '\0';
563 ahprintf(AH, "%s%s%s;\n", cmdBegin, st, cmdEnd);
564
565 /* In --transaction-size mode, count each command as an action */
566 if (ropt && ropt->txn_size > 0)
567 {
568 if (++AH->txnCount >= ropt->txn_size)
569 {
570 if (AH->connection)
571 {
574 }
575 else
576 ahprintf(AH, "COMMIT;\nBEGIN;\n\n");
577 AH->txnCount = 0;
578 }
579 }
580
581 st = en;
582 }
583 ahprintf(AH, "\n");
584 pg_free(buf);
585}
586
587/*
588 * Process a "LARGE OBJECTS" ACL TocEntry.
589 *
590 * To save space in the dump file, the TocEntry contains only one copy
591 * of the required GRANT/REVOKE commands, written to apply to the first
592 * blob in the group (although we do not depend on that detail here).
593 * We must expand the text to generate commands for all the blobs listed
594 * in the associated BLOB METADATA entry.
595 */
596void
598{
599 TocEntry *blobte = getTocEntryByDumpId(AH, te->dependencies[0]);
600 char *buf;
601 char *st;
602 char *st2;
603 char *en;
604 bool inquotes;
605
606 if (!blobte)
607 pg_fatal("could not find entry for ID %d", te->dependencies[0]);
608 Assert(strcmp(blobte->desc, "BLOB METADATA") == 0);
609
610 /* Make a writable copy of the ACL commands string */
611 buf = pg_strdup(te->defn);
612
613 /*
614 * We have to parse out the commands sufficiently to locate the blob OIDs
615 * and find the command-ending semicolons. The commands should not
616 * contain anything hard to parse except for double-quoted role names,
617 * which are easy to ignore. Once we've split apart the first and second
618 * halves of a command, apply IssueCommandPerBlob. (This means the
619 * updates on the blobs are interleaved if there's multiple commands, but
620 * that should cause no trouble.)
621 */
622 inquotes = false;
623 st = en = buf;
624 st2 = NULL;
625 while (*en)
626 {
627 /* Ignore double-quoted material */
628 if (*en == '"')
629 inquotes = !inquotes;
630 if (inquotes)
631 {
632 en++;
633 continue;
634 }
635 /* If we found "LARGE OBJECT", that's the end of the first half */
636 if (strncmp(en, "LARGE OBJECT ", 13) == 0)
637 {
638 /* Terminate the first-half string */
639 en += 13;
640 Assert(isdigit((unsigned char) *en));
641 *en++ = '\0';
642 /* Skip the rest of the blob OID */
643 while (isdigit((unsigned char) *en))
644 en++;
645 /* Second half starts here */
646 Assert(st2 == NULL);
647 st2 = en;
648 }
649 /* If we found semicolon, that's the end of the second half */
650 else if (*en == ';')
651 {
652 /* Terminate the second-half string */
653 *en++ = '\0';
654 Assert(st2 != NULL);
655 /* Issue this command for each blob */
656 IssueCommandPerBlob(AH, blobte, st, st2);
657 /* For neatness, skip whitespace before the next command */
658 while (isspace((unsigned char) *en))
659 en++;
660 /* Reset for new command */
661 st = en;
662 st2 = NULL;
663 }
664 else
665 en++;
666 }
667 pg_free(buf);
668}
669
670void
672{
673 ahprintf(AH,
674 "SELECT pg_catalog.lo_unlink(oid) "
675 "FROM pg_catalog.pg_largeobject_metadata "
676 "WHERE oid = '%u';\n",
677 oid);
678}
void set_archive_cancel_info(ArchiveHandle *AH, PGconn *conn)
Definition: parallel.c:732
static Datum values[MAXATTR]
Definition: bootstrap.c:151
#define ngettext(s, p, n)
Definition: c.h:1138
#define Assert(condition)
Definition: c.h:815
#define lengthof(array)
Definition: c.h:745
#define ALWAYS_SECURE_SEARCH_PATH_SQL
Definition: connect.h:25
#define fprintf(file, fmt, msg)
Definition: cubescan.l:21
int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
Definition: fe-cancel.c:463
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:7258
PGTransactionStatusType PQtransactionStatus(const PGconn *conn)
Definition: fe-connect.c:7213
int PQconnectionUsedPassword(const PGconn *conn)
Definition: fe-connect.c:7334
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
Definition: fe-connect.c:7223
int PQconnectionNeedsPassword(const PGconn *conn)
Definition: fe-connect.c:7319
char * PQpass(const PGconn *conn)
Definition: fe-connect.c:7120
ConnStatusType PQstatus(const PGconn *conn)
Definition: fe-connect.c:7205
void PQfinish(PGconn *conn)
Definition: fe-connect.c:4939
PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg)
Definition: fe-connect.c:7447
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:7268
PGconn * PQconnectdbParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:698
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3876
PGresult * PQgetResult(PGconn *conn)
Definition: fe-exec.c:2062
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:3411
int PQputCopyEnd(PGconn *conn, const char *errormsg)
Definition: fe-exec.c:2749
int PQntuples(const PGresult *res)
Definition: fe-exec.c:3481
int PQputCopyData(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2695
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:2262
void * pg_malloc(size_t size)
Definition: fe_memutils.c:47
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
void pg_free(void *ptr)
Definition: fe_memutils.c:105
const char * str
#define free(a)
Definition: header.h:65
int i
Definition: isn.c:72
static const JsonPathKeyword keywords[]
@ CONNECTION_BAD
Definition: libpq-fe.h:82
ExecStatusType
Definition: libpq-fe.h:118
@ PGRES_COPY_IN
Definition: libpq-fe.h:127
@ PGRES_COMMAND_OK
Definition: libpq-fe.h:120
@ PGRES_EMPTY_QUERY
Definition: libpq-fe.h:119
@ PGRES_TUPLES_OK
Definition: libpq-fe.h:123
@ PQTRANS_ACTIVE
Definition: libpq-fe.h:143
exit(1)
#define pg_log_error(...)
Definition: logging.h:106
#define pg_log_info(...)
Definition: logging.h:124
#define pg_log_error_detail(...)
Definition: logging.h:109
const char * progname
Definition: main.c:44
void warn_or_exit_horribly(ArchiveHandle *AH, const char *fmt,...)
TocEntry * getTocEntryByDumpId(ArchiveHandle *AH, DumpId id)
int ahprintf(ArchiveHandle *AH, const char *fmt,...)
@ SQL_IN_DOUBLE_QUOTE
@ SQL_IN_SINGLE_QUOTE
@ SQL_SCAN
@ OUTPUT_COPYDATA
@ OUTPUT_OTHERDATA
void ConnectDatabase(Archive *AHX, const ConnParams *cparams, bool isReconnect)
Definition: pg_backup_db.c:108
void ExecuteSqlStatement(Archive *AHX, const char *query)
Definition: pg_backup_db.c:276
PGconn * GetConnection(Archive *AHX)
Definition: pg_backup_db.c:252
void IssueACLPerBlob(ArchiveHandle *AH, TocEntry *te)
Definition: pg_backup_db.c:597
void EndDBCopyMode(Archive *AHX, const char *tocEntryTag)
Definition: pg_backup_db.c:498
static void die_on_query_failure(ArchiveHandle *AH, const char *query)
Definition: pg_backup_db.c:267
PGresult * ExecuteSqlQuery(Archive *AHX, const char *query, ExecStatusType status)
Definition: pg_backup_db.c:288
PGresult * ExecuteSqlQueryForSingleRow(Archive *fout, const char *query)
Definition: pg_backup_db.c:303
static void _check_database_version(ArchiveHandle *AH)
Definition: pg_backup_db.c:31
void DropLOIfExists(ArchiveHandle *AH, Oid oid)
Definition: pg_backup_db.c:671
void ReconnectToServer(ArchiveHandle *AH, const char *dbname)
Definition: pg_backup_db.c:72
static void ExecuteSimpleCommands(ArchiveHandle *AH, const char *buf, size_t bufLen)
Definition: pg_backup_db.c:378
void StartTransaction(Archive *AHX)
Definition: pg_backup_db.c:527
void IssueCommandPerBlob(ArchiveHandle *AH, TocEntry *te, const char *cmdBegin, const char *cmdEnd)
Definition: pg_backup_db.c:550
int ExecuteSqlCommandBuf(Archive *AHX, const char *buf, size_t bufLen)
Definition: pg_backup_db.c:443
static void ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc)
Definition: pg_backup_db.c:326
static void notice_processor(void *arg, const char *message)
Definition: pg_backup_db.c:260
void DisconnectDatabase(Archive *AHX)
Definition: pg_backup_db.c:223
void CommitTransaction(Archive *AHX)
Definition: pg_backup_db.c:535
void * arg
#define pg_fatal(...)
static char * buf
Definition: pg_test_fsync.c:72
#define pg_log_warning(...)
Definition: pgfnames.c:24
unsigned int Oid
Definition: postgres_ext.h:32
PQExpBuffer createPQExpBuffer(void)
Definition: pqexpbuffer.c:72
void resetPQExpBuffer(PQExpBuffer str)
Definition: pqexpbuffer.c:146
void appendPQExpBufferChar(PQExpBuffer str, char ch)
Definition: pqexpbuffer.c:378
char * simple_prompt(const char *prompt, bool echo)
Definition: sprompt.c:38
static char * password
Definition: streamutil.c:52
char * dbname
Definition: streamutil.c:50
PGconn * conn
Definition: streamutil.c:53
int remoteVersion
Definition: pg_backup.h:224
char * remoteVersionStr
Definition: pg_backup.h:223
bool isStandby
Definition: pg_backup.h:225
int maxRemoteVersion
Definition: pg_backup.h:228
bool std_strings
Definition: pg_backup.h:235
RestoreOptions * ropt
Definition: pg_backup.h:220
PGcancel *volatile connCancel
sqlparseInfo sqlparse
ArchiverOutput outputKind
char * override_dbname
Definition: pg_backup.h:92
char * pgport
Definition: pg_backup.h:86
char * pghost
Definition: pg_backup.h:87
trivalue promptPassword
Definition: pg_backup.h:89
char * username
Definition: pg_backup.h:88
char * dbname
Definition: pg_backup.h:85
ConnParams cparams
Definition: pg_backup.h:143
DumpId * dependencies
PQExpBuffer curCmd
sqlparseState state
trivalue
Definition: vacuumlo.c:35
@ TRI_YES
Definition: vacuumlo.c:38
@ TRI_NO
Definition: vacuumlo.c:37