PostgreSQL Source Code  git master
oid2name.c
Go to the documentation of this file.
1 /*
2  * oid2name, a PostgreSQL app to map OIDs on the filesystem
3  * to table and database names.
4  *
5  * Originally by
6  * B. Palmer, bpalmer@crimelabs.net 1-17-2001
7  *
8  * contrib/oid2name/oid2name.c
9  */
10 #include "postgres_fe.h"
11 
12 #include "catalog/pg_class_d.h"
13 
14 #include "common/logging.h"
15 #include "fe_utils/connect.h"
16 #include "libpq-fe.h"
17 #include "pg_getopt.h"
18 #include "getopt_long.h"
19 
20 
21 /* an extensible array to keep track of elements to show */
22 typedef struct
23 {
24  char **array;
25  int num;
26  int alloc;
27 } eary;
28 
29 /* these are the opts structures for command line params */
30 struct options
31 {
35 
36  bool quiet;
37  bool systables;
38  bool indexes;
39  bool nodb;
40  bool extended;
42 
43  char *dbname;
44  char *hostname;
45  char *port;
46  char *username;
47  const char *progname;
48 };
49 
50 /* function prototypes */
51 static void help(const char *progname);
52 void get_opts(int, char **, struct options *);
53 void add_one_elt(char *eltname, eary *eary);
54 char *get_comma_elts(eary *eary);
55 PGconn *sql_conn(struct options *);
56 int sql_exec(PGconn *, const char *sql, bool quiet);
57 void sql_exec_dumpalldbs(PGconn *, struct options *);
58 void sql_exec_dumpalltables(PGconn *, struct options *);
59 void sql_exec_searchtables(PGconn *, struct options *);
60 void sql_exec_dumpalltbspc(PGconn *, struct options *);
61 
62 /* function to parse command line options and check for some usage errors. */
63 void
64 get_opts(int argc, char **argv, struct options *my_opts)
65 {
66  static struct option long_options[] = {
67  {"dbname", required_argument, NULL, 'd'},
68  {"host", required_argument, NULL, 'h'},
69  {"host", required_argument, NULL, 'H'}, /* deprecated */
70  {"filenode", required_argument, NULL, 'f'},
71  {"indexes", no_argument, NULL, 'i'},
72  {"oid", required_argument, NULL, 'o'},
73  {"port", required_argument, NULL, 'p'},
74  {"quiet", no_argument, NULL, 'q'},
75  {"tablespaces", no_argument, NULL, 's'},
76  {"system-objects", no_argument, NULL, 'S'},
77  {"table", required_argument, NULL, 't'},
78  {"username", required_argument, NULL, 'U'},
79  {"version", no_argument, NULL, 'V'},
80  {"extended", no_argument, NULL, 'x'},
81  {"help", no_argument, NULL, '?'},
82  {NULL, 0, NULL, 0}
83  };
84 
85  int c;
86  const char *progname;
87  int optindex;
88 
89  pg_logging_init(argv[0]);
90  progname = get_progname(argv[0]);
91 
92  /* set the defaults */
93  my_opts->quiet = false;
94  my_opts->systables = false;
95  my_opts->indexes = false;
96  my_opts->nodb = false;
97  my_opts->extended = false;
98  my_opts->tablespaces = false;
99  my_opts->dbname = NULL;
100  my_opts->hostname = NULL;
101  my_opts->port = NULL;
102  my_opts->username = NULL;
103  my_opts->progname = progname;
104 
105  if (argc > 1)
106  {
107  if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
108  {
109  help(progname);
110  exit(0);
111  }
112  if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
113  {
114  puts("oid2name (PostgreSQL) " PG_VERSION);
115  exit(0);
116  }
117  }
118 
119  /* get opts */
120  while ((c = getopt_long(argc, argv, "d:f:h:H:io:p:qsSt:U:x", long_options, &optindex)) != -1)
121  {
122  switch (c)
123  {
124  /* specify the database */
125  case 'd':
126  my_opts->dbname = pg_strdup(optarg);
127  break;
128 
129  /* specify one filenode to show */
130  case 'f':
131  add_one_elt(optarg, my_opts->filenodes);
132  break;
133 
134  /* host to connect to */
135  case 'H': /* deprecated */
136  case 'h':
137  my_opts->hostname = pg_strdup(optarg);
138  break;
139 
140  /* also display indexes */
141  case 'i':
142  my_opts->indexes = true;
143  break;
144 
145  /* specify one Oid to show */
146  case 'o':
147  add_one_elt(optarg, my_opts->oids);
148  break;
149 
150  /* port to connect to on remote host */
151  case 'p':
152  my_opts->port = pg_strdup(optarg);
153  break;
154 
155  /* don't show headers */
156  case 'q':
157  my_opts->quiet = true;
158  break;
159 
160  /* dump tablespaces only */
161  case 's':
162  my_opts->tablespaces = true;
163  break;
164 
165  /* display system tables */
166  case 'S':
167  my_opts->systables = true;
168  break;
169 
170  /* specify one tablename to show */
171  case 't':
172  add_one_elt(optarg, my_opts->tables);
173  break;
174 
175  /* username */
176  case 'U':
177  my_opts->username = pg_strdup(optarg);
178  break;
179 
180  /* display extra columns */
181  case 'x':
182  my_opts->extended = true;
183  break;
184 
185  default:
186  fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
187  exit(1);
188  }
189  }
190 
191  if (optind < argc)
192  {
193  fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
194  progname, argv[optind]);
195  fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
196  exit(1);
197  }
198 }
199 
200 static void
201 help(const char *progname)
202 {
203  printf("%s helps examining the file structure used by PostgreSQL.\n\n"
204  "Usage:\n"
205  " %s [OPTION]...\n"
206  "\nOptions:\n"
207  " -f, --filenode=FILENODE show info for table with given file node\n"
208  " -i, --indexes show indexes and sequences too\n"
209  " -o, --oid=OID show info for table with given OID\n"
210  " -q, --quiet quiet (don't show headers)\n"
211  " -s, --tablespaces show all tablespaces\n"
212  " -S, --system-objects show system objects too\n"
213  " -t, --table=TABLE show info for named table\n"
214  " -V, --version output version information, then exit\n"
215  " -x, --extended extended (show additional columns)\n"
216  " -?, --help show this help, then exit\n"
217  "\nConnection options:\n"
218  " -d, --dbname=DBNAME database to connect to\n"
219  " -h, --host=HOSTNAME database server host or socket directory\n"
220  " -H same as -h, deprecated option\n"
221  " -p, --port=PORT database server port number\n"
222  " -U, --username=USERNAME connect as specified database user\n"
223  "\nThe default action is to show all database OIDs.\n\n"
224  "Report bugs to <pgsql-bugs@lists.postgresql.org>.\n",
225  progname, progname);
226 }
227 
228 /*
229  * add_one_elt
230  *
231  * Add one element to a (possibly empty) eary struct.
232  */
233 void
234 add_one_elt(char *eltname, eary *eary)
235 {
236  if (eary->alloc == 0)
237  {
238  eary ->alloc = 8;
239  eary ->array = (char **) pg_malloc(8 * sizeof(char *));
240  }
241  else if (eary->num >= eary->alloc)
242  {
243  eary ->alloc *= 2;
244  eary ->array = (char **) pg_realloc(eary->array,
245  eary->alloc * sizeof(char *));
246  }
247 
248  eary ->array[eary->num] = pg_strdup(eltname);
249  eary ->num++;
250 }
251 
252 /*
253  * get_comma_elts
254  *
255  * Return the elements of an eary as a (freshly allocated) single string, in
256  * single quotes, separated by commas and properly escaped for insertion in an
257  * SQL statement.
258  */
259 char *
261 {
262  char *ret,
263  *ptr;
264  int i,
265  length = 0;
266 
267  if (eary->num == 0)
268  return pg_strdup("");
269 
270  /*
271  * PQescapeString wants 2 * length + 1 bytes of breath space. Add two
272  * chars per element for the single quotes and one for the comma.
273  */
274  for (i = 0; i < eary->num; i++)
275  length += strlen(eary->array[i]);
276 
277  ret = (char *) pg_malloc(length * 2 + 4 * eary->num);
278  ptr = ret;
279 
280  for (i = 0; i < eary->num; i++)
281  {
282  if (i != 0)
283  sprintf(ptr++, ",");
284  sprintf(ptr++, "'");
285  ptr += PQescapeString(ptr, eary->array[i], strlen(eary->array[i]));
286  sprintf(ptr++, "'");
287  }
288 
289  return ret;
290 }
291 
292 /* establish connection with database. */
293 PGconn *
294 sql_conn(struct options *my_opts)
295 {
296  PGconn *conn;
297  bool have_password = false;
298  char password[100];
299  bool new_pass;
300  PGresult *res;
301 
302  /*
303  * Start the connection. Loop until we have a password if requested by
304  * backend.
305  */
306  do
307  {
308 #define PARAMS_ARRAY_SIZE 7
309 
310  const char *keywords[PARAMS_ARRAY_SIZE];
311  const char *values[PARAMS_ARRAY_SIZE];
312 
313  keywords[0] = "host";
314  values[0] = my_opts->hostname;
315  keywords[1] = "port";
316  values[1] = my_opts->port;
317  keywords[2] = "user";
318  values[2] = my_opts->username;
319  keywords[3] = "password";
320  values[3] = have_password ? password : NULL;
321  keywords[4] = "dbname";
322  values[4] = my_opts->dbname;
323  keywords[5] = "fallback_application_name";
324  values[5] = my_opts->progname;
325  keywords[6] = NULL;
326  values[6] = NULL;
327 
328  new_pass = false;
329  conn = PQconnectdbParams(keywords, values, true);
330 
331  if (!conn)
332  {
333  pg_log_error("could not connect to database %s",
334  my_opts->dbname);
335  exit(1);
336  }
337 
338  if (PQstatus(conn) == CONNECTION_BAD &&
340  !have_password)
341  {
342  PQfinish(conn);
343  simple_prompt("Password: ", password, sizeof(password), false);
344  have_password = true;
345  new_pass = true;
346  }
347  } while (new_pass);
348 
349  /* check to see that the backend connection was successfully made */
350  if (PQstatus(conn) == CONNECTION_BAD)
351  {
352  pg_log_error("could not connect to database %s: %s",
353  my_opts->dbname, PQerrorMessage(conn));
354  PQfinish(conn);
355  exit(1);
356  }
357 
359  if (PQresultStatus(res) != PGRES_TUPLES_OK)
360  {
361  pg_log_error("could not clear search_path: %s",
362  PQerrorMessage(conn));
363  PQclear(res);
364  PQfinish(conn);
365  exit(-1);
366  }
367  PQclear(res);
368 
369  /* return the conn if good */
370  return conn;
371 }
372 
373 /*
374  * Actual code to make call to the database and print the output data.
375  */
376 int
377 sql_exec(PGconn *conn, const char *todo, bool quiet)
378 {
379  PGresult *res;
380 
381  int nfields;
382  int nrows;
383  int i,
384  j,
385  l;
386  int *length;
387  char *pad;
388 
389  /* make the call */
390  res = PQexec(conn, todo);
391 
392  /* check and deal with errors */
393  if (!res || PQresultStatus(res) > 2)
394  {
395  pg_log_error("query failed: %s", PQerrorMessage(conn));
396  pg_log_error("query was: %s", todo);
397 
398  PQclear(res);
399  PQfinish(conn);
400  exit(-1);
401  }
402 
403  /* get the number of fields */
404  nrows = PQntuples(res);
405  nfields = PQnfields(res);
406 
407  /* for each field, get the needed width */
408  length = (int *) pg_malloc(sizeof(int) * nfields);
409  for (j = 0; j < nfields; j++)
410  length[j] = strlen(PQfname(res, j));
411 
412  for (i = 0; i < nrows; i++)
413  {
414  for (j = 0; j < nfields; j++)
415  {
416  l = strlen(PQgetvalue(res, i, j));
417  if (l > length[j])
418  length[j] = strlen(PQgetvalue(res, i, j));
419  }
420  }
421 
422  /* print a header */
423  if (!quiet)
424  {
425  for (j = 0, l = 0; j < nfields; j++)
426  {
427  fprintf(stdout, "%*s", length[j] + 2, PQfname(res, j));
428  l += length[j] + 2;
429  }
430  fprintf(stdout, "\n");
431  pad = (char *) pg_malloc(l + 1);
432  MemSet(pad, '-', l);
433  pad[l] = '\0';
434  fprintf(stdout, "%s\n", pad);
435  free(pad);
436  }
437 
438  /* for each row, dump the information */
439  for (i = 0; i < nrows; i++)
440  {
441  for (j = 0; j < nfields; j++)
442  fprintf(stdout, "%*s", length[j] + 2, PQgetvalue(res, i, j));
443  fprintf(stdout, "\n");
444  }
445 
446  /* cleanup */
447  PQclear(res);
448  free(length);
449 
450  return 0;
451 }
452 
453 /*
454  * Dump all databases. There are no system objects to worry about.
455  */
456 void
458 {
459  char todo[1024];
460 
461  /* get the oid and database name from the system pg_database table */
462  snprintf(todo, sizeof(todo),
463  "SELECT d.oid AS \"Oid\", datname AS \"Database Name\", "
464  "spcname AS \"Tablespace\" FROM pg_catalog.pg_database d JOIN pg_catalog.pg_tablespace t ON "
465  "(dattablespace = t.oid) ORDER BY 2");
466 
467  sql_exec(conn, todo, opts->quiet);
468 }
469 
470 /*
471  * Dump all tables, indexes and sequences in the current database.
472  */
473 void
475 {
476  char todo[1024];
477  char *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" ";
478 
479  snprintf(todo, sizeof(todo),
480  "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s "
481  "FROM pg_catalog.pg_class c "
482  " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace "
483  " LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),"
484  " pg_catalog.pg_tablespace t "
485  "WHERE relkind IN (" CppAsString2(RELKIND_RELATION) ","
486  CppAsString2(RELKIND_MATVIEW) "%s%s) AND "
487  " %s"
488  " t.oid = CASE"
489  " WHEN reltablespace <> 0 THEN reltablespace"
490  " ELSE dattablespace"
491  " END "
492  "ORDER BY relname",
493  opts->extended ? addfields : "",
494  opts->indexes ? "," CppAsString2(RELKIND_INDEX) "," CppAsString2(RELKIND_SEQUENCE) : "",
495  opts->systables ? "," CppAsString2(RELKIND_TOASTVALUE) : "",
496  opts->systables ? "" : "n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND");
497 
498  sql_exec(conn, todo, opts->quiet);
499 }
500 
501 /*
502  * Show oid, filenode, name, schema and tablespace for each of the
503  * given objects in the current database.
504  */
505 void
507 {
508  char *todo;
509  char *qualifiers,
510  *ptr;
511  char *comma_oids,
512  *comma_filenodes,
513  *comma_tables;
514  bool written = false;
515  char *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" ";
516 
517  /* get tables qualifiers, whether names, filenodes, or OIDs */
518  comma_oids = get_comma_elts(opts->oids);
519  comma_tables = get_comma_elts(opts->tables);
520  comma_filenodes = get_comma_elts(opts->filenodes);
521 
522  /* 80 extra chars for SQL expression */
523  qualifiers = (char *) pg_malloc(strlen(comma_oids) + strlen(comma_tables) +
524  strlen(comma_filenodes) + 80);
525  ptr = qualifiers;
526 
527  if (opts->oids->num > 0)
528  {
529  ptr += sprintf(ptr, "c.oid IN (%s)", comma_oids);
530  written = true;
531  }
532  if (opts->filenodes->num > 0)
533  {
534  if (written)
535  ptr += sprintf(ptr, " OR ");
536  ptr += sprintf(ptr, "pg_catalog.pg_relation_filenode(c.oid) IN (%s)", comma_filenodes);
537  written = true;
538  }
539  if (opts->tables->num > 0)
540  {
541  if (written)
542  ptr += sprintf(ptr, " OR ");
543  sprintf(ptr, "c.relname ~~ ANY (ARRAY[%s])", comma_tables);
544  }
545  free(comma_oids);
546  free(comma_tables);
547  free(comma_filenodes);
548 
549  /* now build the query */
550  todo = psprintf(
551  "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n"
552  "FROM pg_catalog.pg_class c\n"
553  " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
554  " LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n"
555  " pg_catalog.pg_tablespace t\n"
556  "WHERE relkind IN (" CppAsString2(RELKIND_RELATION) ","
557  CppAsString2(RELKIND_MATVIEW) ","
558  CppAsString2(RELKIND_INDEX) ","
559  CppAsString2(RELKIND_SEQUENCE) ","
560  CppAsString2(RELKIND_TOASTVALUE) ") AND\n"
561  " t.oid = CASE\n"
562  " WHEN reltablespace <> 0 THEN reltablespace\n"
563  " ELSE dattablespace\n"
564  " END AND\n"
565  " (%s)\n"
566  "ORDER BY relname\n",
567  opts->extended ? addfields : "",
568  qualifiers);
569 
570  free(qualifiers);
571 
572  sql_exec(conn, todo, opts->quiet);
573 }
574 
575 void
577 {
578  char todo[1024];
579 
580  snprintf(todo, sizeof(todo),
581  "SELECT oid AS \"Oid\", spcname as \"Tablespace Name\"\n"
582  "FROM pg_catalog.pg_tablespace");
583 
584  sql_exec(conn, todo, opts->quiet);
585 }
586 
587 int
588 main(int argc, char **argv)
589 {
590  struct options *my_opts;
591  PGconn *pgconn;
592 
593  my_opts = (struct options *) pg_malloc(sizeof(struct options));
594 
595  my_opts->oids = (eary *) pg_malloc(sizeof(eary));
596  my_opts->tables = (eary *) pg_malloc(sizeof(eary));
597  my_opts->filenodes = (eary *) pg_malloc(sizeof(eary));
598 
599  my_opts->oids->num = my_opts->oids->alloc = 0;
600  my_opts->tables->num = my_opts->tables->alloc = 0;
601  my_opts->filenodes->num = my_opts->filenodes->alloc = 0;
602 
603  /* parse the opts */
604  get_opts(argc, argv, my_opts);
605 
606  if (my_opts->dbname == NULL)
607  {
608  my_opts->dbname = "postgres";
609  my_opts->nodb = true;
610  }
611  pgconn = sql_conn(my_opts);
612 
613  /* display only tablespaces */
614  if (my_opts->tablespaces)
615  {
616  if (!my_opts->quiet)
617  printf("All tablespaces:\n");
618  sql_exec_dumpalltbspc(pgconn, my_opts);
619 
620  PQfinish(pgconn);
621  exit(0);
622  }
623 
624  /* display the given elements in the database */
625  if (my_opts->oids->num > 0 ||
626  my_opts->tables->num > 0 ||
627  my_opts->filenodes->num > 0)
628  {
629  if (!my_opts->quiet)
630  printf("From database \"%s\":\n", my_opts->dbname);
631  sql_exec_searchtables(pgconn, my_opts);
632 
633  PQfinish(pgconn);
634  exit(0);
635  }
636 
637  /* no elements given; dump the given database */
638  if (my_opts->dbname && !my_opts->nodb)
639  {
640  if (!my_opts->quiet)
641  printf("From database \"%s\":\n", my_opts->dbname);
642  sql_exec_dumpalltables(pgconn, my_opts);
643 
644  PQfinish(pgconn);
645  exit(0);
646  }
647 
648  /* no database either; dump all databases */
649  if (!my_opts->quiet)
650  printf("All databases:\n");
651  sql_exec_dumpalldbs(pgconn, my_opts);
652 
653  PQfinish(pgconn);
654  return 0;
655 }
int sql_exec(PGconn *, const char *sql, bool quiet)
Definition: oid2name.c:377
static char password[100]
Definition: streamutil.c:55
int PQnfields(const PGresult *res)
Definition: fe-exec.c:2778
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:6561
Definition: oid2name.c:22
void sql_exec_dumpalltbspc(PGconn *, struct options *)
Definition: oid2name.c:576
size_t PQescapeString(char *to, const char *from, size_t length)
Definition: fe-exec.c:3429
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3164
char * PQfname(const PGresult *res, int field_num)
Definition: fe-exec.c:2856
void * pg_malloc(size_t size)
Definition: fe_memutils.c:47
const char * get_progname(const char *argv0)
Definition: path.c:453
PGconn * sql_conn(struct options *)
Definition: oid2name.c:294
#define pg_log_error(...)
Definition: logging.h:79
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
Definition: getopt_long.c:57
void get_opts(int, char **, struct options *)
Definition: oid2name.c:64
void pg_logging_init(const char *argv0)
Definition: logging.c:39
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
#define PARAMS_ARRAY_SIZE
void PQfinish(PGconn *conn)
Definition: fe-connect.c:4063
#define MemSet(start, val, len)
Definition: c.h:955
#define printf(...)
Definition: port.h:198
char * hostname
Definition: oid2name.c:44
bool nodb
Definition: oid2name.c:39
int PQntuples(const PGresult *res)
Definition: fe-exec.c:2770
char * username
Definition: oid2name.c:46
#define fprintf
Definition: port.h:196
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:2693
int main(int argc, char **argv)
Definition: oid2name.c:588
PGconn * PQconnectdbParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:613
bool tablespaces
Definition: oid2name.c:41
char ** array
Definition: oid2name.c:24
static void help(const char *progname)
Definition: oid2name.c:201
void sql_exec_dumpalldbs(PGconn *, struct options *)
Definition: oid2name.c:457
#define sprintf
Definition: port.h:194
#define required_argument
Definition: getopt_long.h:25
int optind
Definition: getopt.c:50
eary * oids
Definition: oid2name.c:33
PGconn * conn
Definition: streamutil.c:56
bool indexes
Definition: oid2name.c:38
char * c
bool systables
Definition: oid2name.c:37
void simple_prompt(const char *prompt, char *destination, size_t destlen, bool echo)
Definition: sprompt.c:37
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
void * pg_realloc(void *ptr, size_t size)
Definition: fe_memutils.c:65
eary * tables
Definition: oid2name.c:32
#define CppAsString2(x)
Definition: c.h:224
#define no_argument
Definition: getopt_long.h:24
void add_one_elt(char *eltname, eary *eary)
Definition: oid2name.c:234
const char * progname
Definition: oid2name.c:47
char * dbname
Definition: oid2name.c:43
void PQclear(PGresult *res)
Definition: fe-exec.c:695
#define free(a)
Definition: header.h:65
bool quiet
Definition: oid2name.c:36
static bool have_password
Definition: streamutil.c:54
bool extended
Definition: oid2name.c:40
char * get_comma_elts(eary *eary)
Definition: oid2name.c:260
#define ALWAYS_SECURE_SEARCH_PATH_SQL
Definition: connect.h:25
static Datum values[MAXATTR]
Definition: bootstrap.c:167
int alloc
Definition: oid2name.c:26
int PQconnectionNeedsPassword(const PGconn *conn)
Definition: fe-connect.c:6595
void sql_exec_searchtables(PGconn *, struct options *)
Definition: oid2name.c:506
char * optarg
Definition: getopt.c:52
char * port
Definition: oid2name.c:45
int i
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:1940
eary * filenodes
Definition: oid2name.c:34
ConnStatusType PQstatus(const PGconn *conn)
Definition: fe-connect.c:6508
#define snprintf
Definition: port.h:192
#define _(x)
Definition: elog.c:84
int num
Definition: oid2name.c:25
void sql_exec_dumpalltables(PGconn *, struct options *)
Definition: oid2name.c:474