mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Remove -c option for Constraint syntax so we us it by default.
This commit is contained in:
parent
5fdefbc7ef
commit
454913c19a
@ -21,7 +21,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.75 1998/06/19 02:55:14 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.76 1998/06/20 02:49:38 momjian Exp $
|
||||||
*
|
*
|
||||||
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
||||||
*
|
*
|
||||||
@ -110,7 +110,6 @@ int dumpData; /* dump data using proper insert strings */
|
|||||||
int attrNames; /* put attr names into insert strings */
|
int attrNames; /* put attr names into insert strings */
|
||||||
int schemaOnly;
|
int schemaOnly;
|
||||||
int dataOnly;
|
int dataOnly;
|
||||||
int compatConstraint;
|
|
||||||
|
|
||||||
char g_opaque_type[10]; /* name for the opaque type */
|
char g_opaque_type[10]; /* name for the opaque type */
|
||||||
|
|
||||||
@ -126,8 +125,6 @@ usage(const char *progname)
|
|||||||
"usage: %s [options] dbname\n", progname);
|
"usage: %s [options] dbname\n", progname);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\t -a \t\t dump out only the data, no schema\n");
|
"\t -a \t\t dump out only the data, no schema\n");
|
||||||
fprintf(stderr,
|
|
||||||
"\t -c \t\t generate pgsql-compatible CONSTRAINT syntax\n");
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\t -d \t\t dump data as proper insert strings\n");
|
"\t -d \t\t dump data as proper insert strings\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -553,21 +550,17 @@ main(int argc, char **argv)
|
|||||||
g_comment_end[0] = '\0';
|
g_comment_end[0] = '\0';
|
||||||
strcpy(g_opaque_type, "opaque");
|
strcpy(g_opaque_type, "opaque");
|
||||||
|
|
||||||
compatConstraint = dataOnly = schemaOnly = dumpData = attrNames = 0;
|
dataOnly = schemaOnly = dumpData = attrNames = 0;
|
||||||
|
|
||||||
progname = *argv;
|
progname = *argv;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "acdDf:h:op:st:vzu")) != EOF)
|
while ((c = getopt(argc, argv, "adDf:h:op:st:vzu")) != EOF)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case 'a': /* Dump data only */
|
case 'a': /* Dump data only */
|
||||||
dataOnly = 1;
|
dataOnly = 1;
|
||||||
break;
|
break;
|
||||||
case 'c': /* generate constraint syntax that
|
|
||||||
can be read back into postgreSQL */
|
|
||||||
compatConstraint = 1;
|
|
||||||
break;
|
|
||||||
case 'd': /* dump data as proper insert strings */
|
case 'd': /* dump data as proper insert strings */
|
||||||
dumpData = 1;
|
dumpData = 1;
|
||||||
break;
|
break;
|
||||||
@ -1499,12 +1492,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
|
|||||||
query[0] = 0;
|
query[0] = 0;
|
||||||
if (name[0] != '$')
|
if (name[0] != '$')
|
||||||
sprintf(query, "CONSTRAINT %s ", name);
|
sprintf(query, "CONSTRAINT %s ", name);
|
||||||
if( compatConstraint ) {
|
|
||||||
sprintf(query, "%sCHECK (%s)", query, expr);
|
sprintf(query, "%sCHECK (%s)", query, expr);
|
||||||
}
|
|
||||||
else {
|
|
||||||
sprintf(query, "%sCHECK %s", query, expr);
|
|
||||||
}
|
|
||||||
tblinfo[i].check_expr[i2] = strdup(query);
|
tblinfo[i].check_expr[i2] = strdup(query);
|
||||||
}
|
}
|
||||||
PQclear(res2);
|
PQclear(res2);
|
||||||
@ -2522,7 +2510,6 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( compatConstraint ) {
|
|
||||||
/* put the CONSTRAINTS inside the table def */
|
/* put the CONSTRAINTS inside the table def */
|
||||||
for (k = 0; k < tblinfo[i].ncheck; k++)
|
for (k = 0; k < tblinfo[i].ncheck; k++)
|
||||||
{
|
{
|
||||||
@ -2531,7 +2518,6 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
|
|||||||
(actual_atts + k > 0) ? ", " : "",
|
(actual_atts + k > 0) ? ", " : "",
|
||||||
tblinfo[i].check_expr[k]);
|
tblinfo[i].check_expr[k]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
strcat(q, ")");
|
strcat(q, ")");
|
||||||
|
|
||||||
@ -2548,18 +2534,6 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
|
|||||||
strcat(q, ")");
|
strcat(q, ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !compatConstraint )
|
|
||||||
{
|
|
||||||
/* put the CONSTRAINT defs outside the table def */
|
|
||||||
for (k = 0; k < tblinfo[i].ncheck; k++)
|
|
||||||
{
|
|
||||||
sprintf(q, "%s%s %s",
|
|
||||||
q,
|
|
||||||
(k > 0) ? ", " : "",
|
|
||||||
tblinfo[i].check_expr[k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
strcat(q, ";\n");
|
strcat(q, ";\n");
|
||||||
fputs(q, fout);
|
fputs(q, fout);
|
||||||
if (acls)
|
if (acls)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user