*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.25 1998/09/20 03:18:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.26 1998/10/02 16:43:38 thomas Exp $
*
*
*
* checks input string for non-lowercase characters
* returns pointer to input string or string surrounded by double quotes
+ *
+ * Note that the returned string should be used immediately since it
+ * uses a static buffer to hold the string. Non-reentrant but fast.
*/
const char *
fmtId(const char *rawid)
const char *cp;
static char id[MAXQUERYLEN];
- for (cp = rawid; *cp != '\0'; cp++)
- if (!(islower(*cp) || isdigit(*cp) || (*cp == '_')))
- break;
+ if (! g_force_quotes)
+ for (cp = rawid; *cp != '\0'; cp++)
+ if (!(islower(*cp) || isdigit(*cp) || (*cp == '_')))
+ break;
- if (*cp != '\0')
+ if (g_force_quotes || (*cp != '\0'))
{
strcpy(id, "\"");
strcat(id, rawid);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.87 1998/10/01 01:49:12 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.88 1998/10/02 16:43:40 thomas Exp $
*
*
opterr;
/* global decls */
+bool g_force_quotes; /* User wants to suppress double-quotes */
bool g_verbose; /* User wants verbose narration of our
* activities. */
int g_last_builtin_oid; /* value of the last builtin oid */
fprintf(stderr,
"\t -d \t\t dump data as proper insert strings\n");
fprintf(stderr,
- "\t -D \t\t dump data as inserts with attribute names\n");
+ "\t -D \t\t dump data as inserts"
+ " with attribute names\n");
fprintf(stderr,
"\t -f filename \t\t script output filename\n");
fprintf(stderr,
"\t -h hostname \t\t server host name\n");
+ fprintf(stderr,
+ "\t -n \t\t suppress most quotes around identifiers\n");
fprintf(stderr,
"\t -o \t\t dump object id's (oids)\n");
fprintf(stderr,
progname = *argv;
- while ((c = getopt(argc, argv, "adDf:h:op:st:vzu")) != EOF)
+ while ((c = getopt(argc, argv, "adDf:h:nop:st:vzu")) != EOF)
{
switch (c)
{
case 'h': /* server host */
pghost = optarg;
break;
+ case 'n': /* Do not force double-quotes on identifiers */
+ g_force_quotes = false;
+ break;
case 'o': /* Dump oids */
oids = 1;
break;
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_dump.h,v 1.32 1998/09/01 04:33:47 momjian Exp $
+ * $Id: pg_dump.h,v 1.33 1998/10/02 16:43:41 thomas Exp $
*
*
/* global decls */
+extern bool g_force_quotes; /* double-quotes for identifiers flag */
extern bool g_verbose; /* verbose flag */
extern int g_last_builtin_oid; /* value of the last builtin oid */
extern FILE *g_fout; /* the script file */