Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dfc1a6a

Browse files
committed
Document pg_dump -z, clean up option list. Fix problem with libpq handling of field names uppercase code.
1 parent df823bc commit dfc1a6a

File tree

5 files changed

+70
-74
lines changed

5 files changed

+70
-74
lines changed

src/backend/catalog/heap.c

+9-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.39 1997/11/28 17:26:51 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.40 1997/12/01 21:00:35 momjian Exp $
1111
*
1212
* INTERFACE ROUTINES
1313
* heap_create() - Create an uncataloged heap relation
@@ -35,26 +35,28 @@
3535
#include <catalog/heap.h>
3636
#include <catalog/index.h>
3737
#include <catalog/indexing.h>
38-
#include <catalog/pg_ipl.h>
38+
#include <catalog/pg_attrdef.h>
39+
#include <catalog/pg_index.h>
3940
#include <catalog/pg_inherits.h>
41+
#include <catalog/pg_ipl.h>
4042
#include <catalog/pg_proc.h>
41-
#include <catalog/pg_index.h>
42-
#include <catalog/pg_type.h>
43-
#include <catalog/pg_attrdef.h>
4443
#include <catalog/pg_relcheck.h>
44+
#include <catalog/pg_type.h>
4545
#include <commands/trigger.h>
46+
#include <nodes/plannodes.h>
47+
#include <optimizer/tlist.h>
4648
#include <parser/parse_expr.h>
4749
#include <parser/parse_node.h>
4850
#include <parser/parse_type.h>
51+
#include <rewrite/rewriteRemove.h>
4952
#include <storage/bufmgr.h>
5053
#include <storage/lmgr.h>
5154
#include <storage/smgr.h>
52-
#include <rewrite/rewriteRemove.h>
55+
#include <tcop/tcopprot.h>
5356
#include <utils/builtins.h>
5457
#include <utils/mcxt.h>
5558
#include <utils/relcache.h>
5659
#include <utils/tqual.h>
57-
#include <nodes/plannodes.h>
5860
#ifndef HAVE_MEMMOVE
5961
#include <regex/utils.h>
6062
#else
@@ -1482,10 +1484,6 @@ DestroyTempRels(void)
14821484
tempRels = NULL;
14831485
}
14841486

1485-
extern List *flatten_tlist(List *tlist);
1486-
extern List *
1487-
pg_plan(char *query_string, Oid *typev, int nargs,
1488-
QueryTreeList **queryListP, CommandDest dest);
14891487

14901488
static void
14911489
StoreAttrDefault(Relation rel, AttrDefault *attrdef)

src/bin/pg_dump/pg_dump.c

+28-30
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.53 1997/11/21 18:11:37 momjian Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.54 1997/12/01 21:00:57 momjian Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -106,30 +106,28 @@ char g_comment_end[10];
106106
static void
107107
usage(const char *progname)
108108
{
109-
fprintf(stderr,
110-
"%s - version 1.13.dhb.2\n\n", progname);
111109
fprintf(stderr,
112110
"usage: %s [options] [dbname]\n", progname);
113111
fprintf(stderr,
114-
"\t -f filename \t\t script output filename\n");
112+
"\t -a \t\t dump out only the data, no schema\n");
115113
fprintf(stderr,
116-
"\t -h hostname \t\t server host name\n");
114+
"\t -d \t\t dump data as proper insert strings\n");
117115
fprintf(stderr,
118-
"\t -p port \t\t server port number\n");
116+
"\t -D \t\t dump data as inserts with attribute names\n");
119117
fprintf(stderr,
120-
"\t -v \t\t verbose\n");
118+
"\t -f filename \t\t script output filename\n");
121119
fprintf(stderr,
122-
"\t -d \t\t dump data as proper insert strings\n");
120+
"\t -h hostname \t\t server host name\n");
123121
fprintf(stderr,
124-
"\t -D \t\t dump data as inserts with attribute names\n");
122+
"\t -o \t\t dump object id's (oids)\n");
125123
fprintf(stderr,
126-
"\t -S \t\t dump out only the schema, no data\n");
124+
"\t -p port \t\t server port number\n");
127125
fprintf(stderr,
128-
"\t -a \t\t dump out only the data, no schema\n");
126+
"\t -s \t\t dump out only the schema, no data\n");
129127
fprintf(stderr,
130128
"\t -t table \t\t dump for this table only\n");
131129
fprintf(stderr,
132-
"\t -o \t\t dump object id's (oids)\n");
130+
"\t -v \t\t verbose\n");
133131
fprintf(stderr,
134132
"\t -z \t\t dump ACLs (grant/revoke)\n");
135133
fprintf(stderr,
@@ -479,41 +477,41 @@ main(int argc, char **argv)
479477

480478
progname = *argv;
481479

482-
while ((c = getopt(argc, argv, "f:h:p:t:vSDdDaoz")) != EOF)
480+
while ((c = getopt(argc, argv, "adDf:h:op:st:vz")) != EOF)
483481
{
484482
switch (c)
485483
{
484+
case 'a': /* Dump data only */
485+
dataOnly = 1;
486+
break;
487+
case 'd': /* dump data as proper insert strings */
488+
dumpData = 1;
489+
break;
490+
case 'D': /* dump data as proper insert strings with
491+
* attr names */
492+
dumpData = 1;
493+
attrNames = 1;
494+
break;
486495
case 'f': /* output file name */
487496
filename = optarg;
488497
break;
489498
case 'h': /* server host */
490499
pghost = optarg;
491500
break;
501+
case 'o': /* Dump oids */
502+
oids = 1;
503+
break;
492504
case 'p': /* server port */
493505
pgport = optarg;
494506
break;
495-
case 'v': /* verbose */
496-
g_verbose = true;
497-
break;
498-
case 'S': /* dump schema only */
507+
case 's': /* dump schema only */
499508
schemaOnly = 1;
500509
break;
501-
case 'd': /* dump data as proper insert strings */
502-
dumpData = 1;
503-
break;
504-
case 'D': /* dump data as proper insert strings with
505-
* attr names */
506-
dumpData = 1;
507-
attrNames = 1;
508-
break;
509510
case 't': /* Dump data for this table only */
510511
tablename = optarg;
511512
break;
512-
case 'a': /* Dump data only */
513-
dataOnly = 1;
514-
break;
515-
case 'o': /* Dump oids */
516-
oids = 1;
513+
case 'v': /* verbose */
514+
g_verbose = true;
517515
break;
518516
case 'z': /* Dump oids */
519517
acls = 1;

src/interfaces/libpq/fe-connect.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.47 1997/11/17 16:42:39 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.48 1997/12/01 21:01:12 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -430,7 +430,7 @@ PQsetdb(const char *pghost, const char *pgport, const char *pgoptions, const cha
430430
*(conn->dbName + strlen(conn->dbName) - 1) = '\0';
431431
}
432432
else
433-
for (i = 0; conn->dbName[i]; i++)
433+
for (i = strlen(conn->dbName[i]); i >= 0; i--)
434434
if (isupper(conn->dbName[i]))
435435
conn->dbName[i] = tolower(conn->dbName[i]);
436436
}

src/interfaces/libpq/fe-exec.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.40 1997/11/10 05:10:50 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.41 1997/12/01 21:01:18 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1697,7 +1697,7 @@ PQfnumber(PGresult *res, const char *field_name)
16971697
*(field_case + strlen(field_case) - 1) = '\0';
16981698
}
16991699
else
1700-
for (i = 0; field_case; i++)
1700+
for (i = strlen(field_case[i]); i >= 0; i--)
17011701
if (isupper(field_case[i]))
17021702
field_case[i] = tolower(field_case[i]);
17031703

src/man/pg_dump.1

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dump.1,v 1.7 1997/10/30 03:59:59 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dump.1,v 1.8 1997/12/01 21:01:24 momjian Exp $
44
.TH PG_DUMP UNIX 1/20/96 PostgreSQL PostgreSQL
55
.SH NAME
66
pg_dump \(em dumps out a Postgres database into a script file
77
.SH SYNOPSIS
88
.BR pg_dump
99
[\c
10-
.BR "-f"
11-
filename
10+
.BR "-a"
1211
]
1312
[\c
14-
.BR "-h"
15-
hostname
13+
.BR "-d"
1614
]
1715
[\c
18-
.BR "-p"
19-
port]
16+
.BR "-D"
17+
]
2018
[\c
21-
.BR "-v"
19+
.BR "-f"
20+
filename
2221
]
2322
[\c
24-
.BR "-d"
23+
.BR "-h"
24+
hostname
2525
]
2626
[\c
27-
.BR "-D"
27+
.BR "-o"
2828
]
2929
[\c
30-
.BR "-S"
31-
help]
30+
.BR "-p"
31+
port]
3232
[\c
33-
.BR "-a"
33+
.BR "-s"
3434
]
3535
[\c
3636
.BR "-t"
3737
table]
3838
[\c
39-
.BR "-o"
39+
.BR "-v"
4040
]
4141
dbname
4242
.in -5n
@@ -62,35 +62,35 @@ in light of the limitations listed below.
6262
.PP
6363
pg_dump understands the following options:
6464
.TP
65+
.BR "-a" ""
66+
Dump out only the data, no schema
67+
.TP
68+
.BR "-d" ""
69+
Dump data as proper insert strings
70+
.TP
71+
.BR "-D" ""
72+
Dump data as inserts with attribute names
73+
.TP
6574
.BR "-f" " filename"
6675
Specifies the output file
6776
.TP
6877
.BR "-h" " hostname"
6978
Specifies the server host name
7079
.TP
80+
.BR "-o" ""
81+
Dump object id's (oids)
82+
.TP
7183
.BR "-p" " port"
7284
Specifies the server port number
7385
.TP
74-
.BR "-v" ""
75-
Specifies verbose mode
76-
.TP
77-
.BR "-d" ""
78-
Dump data as proper insert strings
79-
.TP
80-
.BR "-D" ""
81-
Dump data as inserts with attribute names
82-
.TP
83-
.BR "-S" ""
86+
.BR "-s" ""
8487
Dump out only the schema, no data
8588
.TP
86-
.BR "-a" ""
87-
Dump out only the data, no schema
88-
.TP
8989
.BR "-t" " table"
9090
Dump for this table only
9191
.TP
92-
.BR "-o" ""
93-
Dump object id's (oids)
92+
.BR "-v" ""
93+
Specifies verbose mode
9494
.PP
9595
If dbname is not supplied, then the DATABASE environment variable value is used.
9696
.SH "CAVEATS AND LIMITATIONS"

0 commit comments

Comments
 (0)