PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
streamutil.c File Reference
#include "postgres_fe.h"
#include <sys/time.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "receivelog.h"
#include "streamutil.h"
#include "pqexpbuffer.h"
#include "common/fe_memutils.h"
#include "datatype/timestamp.h"
Include dependency graph for streamutil.c:

Go to the source code of this file.

Macros

#define ERRCODE_DUPLICATE_OBJECT   "42710"
 

Functions

PGconnGetConnection (void)
 
bool RunIdentifySystem (PGconn *conn, char **sysid, TimeLineID *starttli, XLogRecPtr *startpos, char **db_name)
 
bool CreateReplicationSlot (PGconn *conn, const char *slot_name, const char *plugin, bool is_physical, bool slot_exists_ok)
 
bool DropReplicationSlot (PGconn *conn, const char *slot_name)
 
TimestampTz feGetCurrentTimestamp (void)
 
void feTimestampDifference (TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
 
bool feTimestampDifferenceExceeds (TimestampTz start_time, TimestampTz stop_time, int msec)
 
void fe_sendint64 (int64 i, char *buf)
 
int64 fe_recvint64 (char *buf)
 

Variables

const char * progname
 
char * connection_string = NULL
 
char * dbhost = NULL
 
char * dbuser = NULL
 
char * dbport = NULL
 
char * dbname = NULL
 
int dbgetpassword = 0
 
static bool have_password = false
 
static char password [100]
 
PGconnconn = NULL
 

Macro Definition Documentation

Function Documentation

bool CreateReplicationSlot ( PGconn conn,
const char *  slot_name,
const char *  plugin,
bool  is_physical,
bool  slot_exists_ok 
)

Definition at line 324 of file streamutil.c.

References _, appendPQExpBuffer(), Assert, createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), ERRCODE_DUPLICATE_OBJECT, NULL, PG_DIAG_SQLSTATE, PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQexec(), PQnfields(), PQntuples(), PQresultErrorField(), PQresultStatus(), PQserverVersion(), and progname.

326 {
327  PQExpBuffer query;
328  PGresult *res;
329 
330  query = createPQExpBuffer();
331 
332  Assert((is_physical && plugin == NULL) ||
333  (!is_physical && plugin != NULL));
334  Assert(slot_name != NULL);
335 
336  /* Build query */
337  if (is_physical)
338  appendPQExpBuffer(query, "CREATE_REPLICATION_SLOT \"%s\" PHYSICAL",
339  slot_name);
340  else
341  {
342  appendPQExpBuffer(query, "CREATE_REPLICATION_SLOT \"%s\" LOGICAL \"%s\"",
343  slot_name, plugin);
344  if (PQserverVersion(conn) >= 100000)
345  /* pg_recvlogical doesn't use an exported snapshot, so suppress */
346  appendPQExpBuffer(query, " NOEXPORT_SNAPSHOT");
347  }
348 
349  res = PQexec(conn, query->data);
350  if (PQresultStatus(res) != PGRES_TUPLES_OK)
351  {
352  const char *sqlstate = PQresultErrorField(res, PG_DIAG_SQLSTATE);
353 
354  if (slot_exists_ok &&
355  sqlstate &&
356  strcmp(sqlstate, ERRCODE_DUPLICATE_OBJECT) == 0)
357  {
358  destroyPQExpBuffer(query);
359  PQclear(res);
360  return true;
361  }
362  else
363  {
364  fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
365  progname, query->data, PQerrorMessage(conn));
366 
367  destroyPQExpBuffer(query);
368  PQclear(res);
369  return false;
370  }
371  }
372 
373  if (PQntuples(res) != 1 || PQnfields(res) != 4)
374  {
375  fprintf(stderr,
376  _("%s: could not create replication slot \"%s\": got %d rows and %d fields, expected %d rows and %d fields\n"),
377  progname, slot_name,
378  PQntuples(res), PQnfields(res), 1, 4);
379 
380  destroyPQExpBuffer(query);
381  PQclear(res);
382  return false;
383  }
384 
385  destroyPQExpBuffer(query);
386  PQclear(res);
387  return true;
388 }
static const char * plugin
int PQnfields(const PGresult *res)
Definition: fe-exec.c:2681
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:6097
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:6087
int PQntuples(const PGresult *res)
Definition: fe-exec.c:2673
#define PG_DIAG_SQLSTATE
Definition: postgres_ext.h:57
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:2596
static bool slot_exists_ok
Definition: pg_receivewal.c:41
void destroyPQExpBuffer(PQExpBuffer str)
Definition: pqexpbuffer.c:113
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
Definition: pqexpbuffer.c:262
PQExpBuffer createPQExpBuffer(void)
Definition: pqexpbuffer.c:71
void PQclear(PGresult *res)
Definition: fe-exec.c:650
const char * progname
Definition: streamutil.c:34
char * PQresultErrorField(const PGresult *res, int fieldcode)
Definition: fe-exec.c:2658
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:676
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:1846
#define ERRCODE_DUPLICATE_OBJECT
Definition: streamutil.c:32
#define _(x)
Definition: elog.c:84
bool DropReplicationSlot ( PGconn conn,
const char *  slot_name 
)

Definition at line 395 of file streamutil.c.

References _, appendPQExpBuffer(), Assert, createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), NULL, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), PQnfields(), PQntuples(), PQresultStatus(), and progname.

396 {
397  PQExpBuffer query;
398  PGresult *res;
399 
400  Assert(slot_name != NULL);
401 
402  query = createPQExpBuffer();
403 
404  /* Build query */
405  appendPQExpBuffer(query, "DROP_REPLICATION_SLOT \"%s\"",
406  slot_name);
407  res = PQexec(conn, query->data);
408  if (PQresultStatus(res) != PGRES_COMMAND_OK)
409  {
410  fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
411  progname, query->data, PQerrorMessage(conn));
412 
413  destroyPQExpBuffer(query);
414  PQclear(res);
415  return false;
416  }
417 
418  if (PQntuples(res) != 0 || PQnfields(res) != 0)
419  {
420  fprintf(stderr,
421  _("%s: could not drop replication slot \"%s\": got %d rows and %d fields, expected %d rows and %d fields\n"),
422  progname, slot_name,
423  PQntuples(res), PQnfields(res), 0, 0);
424 
425  destroyPQExpBuffer(query);
426  PQclear(res);
427  return false;
428  }
429 
430  destroyPQExpBuffer(query);
431  PQclear(res);
432  return true;
433 }
int PQnfields(const PGresult *res)
Definition: fe-exec.c:2681
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:6097
int PQntuples(const PGresult *res)
Definition: fe-exec.c:2673
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:2596
void destroyPQExpBuffer(PQExpBuffer str)
Definition: pqexpbuffer.c:113
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
Definition: pqexpbuffer.c:262
PQExpBuffer createPQExpBuffer(void)
Definition: pqexpbuffer.c:71
void PQclear(PGresult *res)
Definition: fe-exec.c:650
const char * progname
Definition: streamutil.c:34
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:676
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:1846
#define _(x)
Definition: elog.c:84
int64 fe_recvint64 ( char *  buf)

Definition at line 514 of file streamutil.c.

References result.

Referenced by ProcessXLogDataMsg(), and StreamLogicalLog().

515 {
516  int64 result;
517  uint32 h32;
518  uint32 l32;
519 
520  memcpy(&h32, buf, 4);
521  memcpy(&l32, buf + 4, 4);
522  h32 = ntohl(h32);
523  l32 = ntohl(l32);
524 
525  result = h32;
526  result <<= 32;
527  result |= l32;
528 
529  return result;
530 }
return result
Definition: formatting.c:1633
static char * buf
Definition: pg_test_fsync.c:66
unsigned int uint32
Definition: c.h:268
void fe_sendint64 ( int64  i,
char *  buf 
)

Definition at line 495 of file streamutil.c.

Referenced by sendFeedback().

496 {
497  uint32 n32;
498 
499  /* High order half first, since we're doing MSB-first */
500  n32 = (uint32) (i >> 32);
501  n32 = htonl(n32);
502  memcpy(&buf[0], &n32, 4);
503 
504  /* Now the low order half */
505  n32 = (uint32) i;
506  n32 = htonl(n32);
507  memcpy(&buf[4], &n32, 4);
508 }
static char * buf
Definition: pg_test_fsync.c:66
unsigned int uint32
Definition: c.h:268
int i
TimestampTz feGetCurrentTimestamp ( void  )

Definition at line 441 of file streamutil.c.

References gettimeofday(), NULL, POSTGRES_EPOCH_JDATE, result, SECS_PER_DAY, UNIX_EPOCH_JDATE, and USECS_PER_SEC.

Referenced by flushAndSendFeedback(), HandleCopyStream(), ProcessKeepaliveMsg(), and StreamLogicalLog().

442 {
444  struct timeval tp;
445 
446  gettimeofday(&tp, NULL);
447 
448  result = (TimestampTz) tp.tv_sec -
450  result = (result * USECS_PER_SEC) + tp.tv_usec;
451 
452  return result;
453 }
int gettimeofday(struct timeval *tp, struct timezone *tzp)
Definition: gettimeofday.c:105
#define USECS_PER_SEC
Definition: timestamp.h:94
int64 TimestampTz
Definition: timestamp.h:39
return result
Definition: formatting.c:1633
#define SECS_PER_DAY
Definition: timestamp.h:86
#define NULL
Definition: c.h:229
#define UNIX_EPOCH_JDATE
Definition: timestamp.h:162
#define POSTGRES_EPOCH_JDATE
Definition: timestamp.h:163
void feTimestampDifference ( TimestampTz  start_time,
TimestampTz  stop_time,
long *  secs,
int *  microsecs 
)

Definition at line 460 of file streamutil.c.

References start_time, and USECS_PER_SEC.

Referenced by CalculateCopyStreamSleeptime(), and StreamLogicalLog().

462 {
463  TimestampTz diff = stop_time - start_time;
464 
465  if (diff <= 0)
466  {
467  *secs = 0;
468  *microsecs = 0;
469  }
470  else
471  {
472  *secs = (long) (diff / USECS_PER_SEC);
473  *microsecs = (int) (diff % USECS_PER_SEC);
474  }
475 }
#define USECS_PER_SEC
Definition: timestamp.h:94
int64 TimestampTz
Definition: timestamp.h:39
static time_t start_time
Definition: pg_ctl.c:103
bool feTimestampDifferenceExceeds ( TimestampTz  start_time,
TimestampTz  stop_time,
int  msec 
)

Definition at line 482 of file streamutil.c.

References INT64CONST, and start_time.

Referenced by HandleCopyStream(), and StreamLogicalLog().

485 {
486  TimestampTz diff = stop_time - start_time;
487 
488  return (diff >= msec * INT64CONST(1000));
489 }
int64 TimestampTz
Definition: timestamp.h:39
static time_t start_time
Definition: pg_ctl.c:103
#define INT64CONST(x)
Definition: c.h:310
PGconn* GetConnection ( void  )

Definition at line 51 of file streamutil.c.

References _, Assert, CONNECTION_BAD, CONNECTION_OK, connection_string, dbgetpassword, dbhost, dbname, dbport, dbuser, free, have_password, i, _PQconninfoOption::keyword, NULL, password, pg_malloc0(), PQconnectdbParams(), PQconnectionNeedsPassword(), PQconninfoFree(), PQconninfoParse(), PQerrorMessage(), PQfinish(), PQparameterStatus(), PQstatus(), progname, simple_prompt(), _PQconninfoOption::val, and values.

52 {
53  PGconn *tmpconn;
54  int argcount = 7; /* dbname, replication, fallback_app_name,
55  * host, user, port, password */
56  int i;
57  const char **keywords;
58  const char **values;
59  const char *tmpparam;
60  bool need_password;
61  PQconninfoOption *conn_opts = NULL;
62  PQconninfoOption *conn_opt;
63  char *err_msg = NULL;
64 
65  /* pg_recvlogical uses dbname only; others use connection_string only. */
67 
68  /*
69  * Merge the connection info inputs given in form of connection string,
70  * options and default values (dbname=replication, replication=true, etc.)
71  * Explicitly discard any dbname value in the connection string;
72  * otherwise, PQconnectdbParams() would interpret that value as being
73  * itself a connection string.
74  */
75  i = 0;
77  {
78  conn_opts = PQconninfoParse(connection_string, &err_msg);
79  if (conn_opts == NULL)
80  {
81  fprintf(stderr, "%s: %s", progname, err_msg);
82  exit(1);
83  }
84 
85  for (conn_opt = conn_opts; conn_opt->keyword != NULL; conn_opt++)
86  {
87  if (conn_opt->val != NULL && conn_opt->val[0] != '\0' &&
88  strcmp(conn_opt->keyword, "dbname") != 0)
89  argcount++;
90  }
91 
92  keywords = pg_malloc0((argcount + 1) * sizeof(*keywords));
93  values = pg_malloc0((argcount + 1) * sizeof(*values));
94 
95  for (conn_opt = conn_opts; conn_opt->keyword != NULL; conn_opt++)
96  {
97  if (conn_opt->val != NULL && conn_opt->val[0] != '\0' &&
98  strcmp(conn_opt->keyword, "dbname") != 0)
99  {
100  keywords[i] = conn_opt->keyword;
101  values[i] = conn_opt->val;
102  i++;
103  }
104  }
105  }
106  else
107  {
108  keywords = pg_malloc0((argcount + 1) * sizeof(*keywords));
109  values = pg_malloc0((argcount + 1) * sizeof(*values));
110  }
111 
112  keywords[i] = "dbname";
113  values[i] = dbname == NULL ? "replication" : dbname;
114  i++;
115  keywords[i] = "replication";
116  values[i] = dbname == NULL ? "true" : "database";
117  i++;
118  keywords[i] = "fallback_application_name";
119  values[i] = progname;
120  i++;
121 
122  if (dbhost)
123  {
124  keywords[i] = "host";
125  values[i] = dbhost;
126  i++;
127  }
128  if (dbuser)
129  {
130  keywords[i] = "user";
131  values[i] = dbuser;
132  i++;
133  }
134  if (dbport)
135  {
136  keywords[i] = "port";
137  values[i] = dbport;
138  i++;
139  }
140 
141  /* If -W was given, force prompt for password, but only the first time */
142  need_password = (dbgetpassword == 1 && !have_password);
143 
144  do
145  {
146  /* Get a new password if appropriate */
147  if (need_password)
148  {
149  simple_prompt("Password: ", password, sizeof(password), false);
150  have_password = true;
151  need_password = false;
152  }
153 
154  /* Use (or reuse, on a subsequent connection) password if we have it */
155  if (have_password)
156  {
157  keywords[i] = "password";
158  values[i] = password;
159  }
160  else
161  {
162  keywords[i] = NULL;
163  values[i] = NULL;
164  }
165 
166  tmpconn = PQconnectdbParams(keywords, values, true);
167 
168  /*
169  * If there is too little memory even to allocate the PGconn object
170  * and PQconnectdbParams returns NULL, we call exit(1) directly.
171  */
172  if (!tmpconn)
173  {
174  fprintf(stderr, _("%s: could not connect to server\n"),
175  progname);
176  exit(1);
177  }
178 
179  /* If we need a password and -w wasn't given, loop back and get one */
180  if (PQstatus(tmpconn) == CONNECTION_BAD &&
181  PQconnectionNeedsPassword(tmpconn) &&
182  dbgetpassword != -1)
183  {
184  PQfinish(tmpconn);
185  need_password = true;
186  }
187  }
188  while (need_password);
189 
190  if (PQstatus(tmpconn) != CONNECTION_OK)
191  {
192  fprintf(stderr, _("%s: could not connect to server: %s"),
193  progname, PQerrorMessage(tmpconn));
194  PQfinish(tmpconn);
195  free(values);
196  free(keywords);
197  if (conn_opts)
198  PQconninfoFree(conn_opts);
199  return NULL;
200  }
201 
202  /* Connection ok! */
203  free(values);
204  free(keywords);
205  if (conn_opts)
206  PQconninfoFree(conn_opts);
207 
208  /*
209  * Ensure we have the same value of integer_datetimes (now always "on") as
210  * the server we are connecting to.
211  */
212  tmpparam = PQparameterStatus(tmpconn, "integer_datetimes");
213  if (!tmpparam)
214  {
215  fprintf(stderr,
216  _("%s: could not determine server setting for integer_datetimes\n"),
217  progname);
218  PQfinish(tmpconn);
219  exit(1);
220  }
221 
222  if (strcmp(tmpparam, "on") != 0)
223  {
224  fprintf(stderr,
225  _("%s: integer_datetimes compile flag does not match server\n"),
226  progname);
227  PQfinish(tmpconn);
228  exit(1);
229  }
230 
231  return tmpconn;
232 }
static char password[100]
Definition: streamutil.c:42
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:6097
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
Definition: fe-connect.c:6062
void PQfinish(PGconn *conn)
Definition: fe-connect.c:3630
PGconn * PQconnectdbParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:529
PQconninfoOption * PQconninfoParse(const char *conninfo, char **errmsg)
Definition: fe-connect.c:4717
char * connection_string
Definition: streamutil.c:35
void * pg_malloc0(size_t size)
Definition: fe_memutils.c:53
void simple_prompt(const char *prompt, char *destination, size_t destlen, bool echo)
Definition: sprompt.c:37
void PQconninfoFree(PQconninfoOption *connOptions)
Definition: fe-connect.c:5947
int dbgetpassword
Definition: streamutil.c:40
char * dbport
Definition: streamutil.c:38
#define free(a)
Definition: header.h:65
static bool have_password
Definition: streamutil.c:41
const char * progname
Definition: streamutil.c:34
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:676
char * dbhost
Definition: streamutil.c:36
char * dbname
Definition: streamutil.c:39
static Datum values[MAXATTR]
Definition: bootstrap.c:163
int PQconnectionNeedsPassword(const PGconn *conn)
Definition: fe-connect.c:6131
char * dbuser
Definition: streamutil.c:37
int i
ConnStatusType PQstatus(const PGconn *conn)
Definition: fe-connect.c:6044
#define _(x)
Definition: elog.c:84
bool RunIdentifySystem ( PGconn conn,
char **  sysid,
TimeLineID starttli,
XLogRecPtr startpos,
char **  db_name 
)

Definition at line 243 of file streamutil.c.

References _, Assert, NULL, pg_strdup(), PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQexec(), PQgetisnull(), PQgetvalue(), PQnfields(), PQntuples(), PQresultStatus(), PQserverVersion(), and progname.

Referenced by BaseBackup(), main(), and StreamLog().

245 {
246  PGresult *res;
247  uint32 hi,
248  lo;
249 
250  /* Check connection existence */
251  Assert(conn != NULL);
252 
253  res = PQexec(conn, "IDENTIFY_SYSTEM");
254  if (PQresultStatus(res) != PGRES_TUPLES_OK)
255  {
256  fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
257  progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
258 
259  PQclear(res);
260  return false;
261  }
262  if (PQntuples(res) != 1 || PQnfields(res) < 3)
263  {
264  fprintf(stderr,
265  _("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
266  progname, PQntuples(res), PQnfields(res), 1, 3);
267 
268  PQclear(res);
269  return false;
270  }
271 
272  /* Get system identifier */
273  if (sysid != NULL)
274  *sysid = pg_strdup(PQgetvalue(res, 0, 0));
275 
276  /* Get timeline ID to start streaming from */
277  if (starttli != NULL)
278  *starttli = atoi(PQgetvalue(res, 0, 1));
279 
280  /* Get LSN start position if necessary */
281  if (startpos != NULL)
282  {
283  if (sscanf(PQgetvalue(res, 0, 2), "%X/%X", &hi, &lo) != 2)
284  {
285  fprintf(stderr,
286  _("%s: could not parse write-ahead log location \"%s\"\n"),
287  progname, PQgetvalue(res, 0, 2));
288 
289  PQclear(res);
290  return false;
291  }
292  *startpos = ((uint64) hi) << 32 | lo;
293  }
294 
295  /* Get database name, only available in 9.4 and newer versions */
296  if (db_name != NULL)
297  {
298  *db_name = NULL;
299  if (PQserverVersion(conn) >= 90400)
300  {
301  if (PQnfields(res) < 4)
302  {
303  fprintf(stderr,
304  _("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
305  progname, PQntuples(res), PQnfields(res), 1, 4);
306 
307  PQclear(res);
308  return false;
309  }
310  if (!PQgetisnull(res, 0, 3))
311  *db_name = pg_strdup(PQgetvalue(res, 0, 3));
312  }
313  }
314 
315  PQclear(res);
316  return true;
317 }
int PQnfields(const PGresult *res)
Definition: fe-exec.c:2681
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:6097
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3067
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:6087
int PQntuples(const PGresult *res)
Definition: fe-exec.c:2673
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:2596
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
unsigned int uint32
Definition: c.h:268
void PQclear(PGresult *res)
Definition: fe-exec.c:650
const char * progname
Definition: streamutil.c:34
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:676
static XLogRecPtr startpos
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:1846
int PQgetisnull(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3092
#define _(x)
Definition: elog.c:84

Variable Documentation

PGconn* conn = NULL

Definition at line 43 of file streamutil.c.

Referenced by BaseBackup(), check_for_isn_and_int8_passing_mismatch(), check_for_jsonb_9_4_usage(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_for_reg_data_type_usage(), check_is_install_user(), check_loadable_libraries(), cluster_all_databases(), cluster_one_database(), connect_pg_server(), connectDatabase(), connectMaintenanceDatabase(), connectToServer(), create_cursor(), dblink_cancel_query(), dblink_close(), dblink_connect(), dblink_disconnect(), dblink_error_message(), dblink_exec(), dblink_fetch(), dblink_get_conn(), dblink_get_notify(), dblink_is_busy(), dblink_open(), dblink_record_internal(), dblink_send_query(), disconnect_and_exit(), doConnect(), dumpBlobs(), dumpDatabase(), dumpTableData_copy(), estimate_path_cost_size(), ExecuteSqlCommand(), fetch_more_data(), freePGconn(), get_db_conn(), get_db_infos(), get_loadable_libraries(), get_rel_infos(), get_tablespace_paths(), init_slot(), libpqrcv_connect(), main(), makeEmptyPGconn(), new_9_0_populate_pg_largeobject_metadata(), old_9_3_check_for_line_data_type_usage(), old_9_6_check_for_unknown_data_type_usage(), old_9_6_invalidate_hash_indexes(), postgresAcquireSampleRowsFunc(), postgresAnalyzeForeignTable(), postgresImportForeignSchema(), PQconnectdb(), PQconnectdbParams(), PQconnectStart(), PQconnectStartParams(), PQfireResultCreateEvents(), PQgetResult(), PQping(), PQpingParams(), PQregisterEventProc(), PQreset(), PQresetPoll(), PQsetdbLogin(), reindex_all_databases(), reindex_one_database(), reindex_system_catalogs(), run_permutation(), set_frozenxids(), setup_connection(), sql_conn(), start_postmaster(), StartLogStreamer(), StreamLog(), StreamLogicalLog(), try_complete_step(), vacuum_all_databases(), vacuum_one_database(), and vacuumlo().

char* connection_string = NULL

Definition at line 35 of file streamutil.c.

Referenced by GetConnection(), and main().

int dbgetpassword = 0

Definition at line 40 of file streamutil.c.

Referenced by GetConnection(), and main().

char* dbhost = NULL

Definition at line 36 of file streamutil.c.

Referenced by GetConnection(), and main().

char* dbport = NULL

Definition at line 38 of file streamutil.c.

Referenced by GetConnection(), and main().

char* dbuser = NULL

Definition at line 37 of file streamutil.c.

Referenced by GetConnection(), and main().

bool have_password = false
static

Definition at line 41 of file streamutil.c.

Referenced by connectDatabase(), doConnect(), GetConnection(), main(), sql_conn(), and vacuumlo().

const char* progname