Commit e18d900d authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Adjust handling of data type names to suppress double quotes

 unless necessary.
Label internal bpchar types as "character" and varchar types as
 "character varying" to be less Postgres-specific. These types map to
 the SQL92 definitions anyway.
Redefine g_force_quotes to be the local variable force_quotes.
Pass this as an argument to fmtId().
These should help with handling the single-byte internal "char" type.
parent 239564e9
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.27 1998/10/06 22:14:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.28 1998/12/13 23:41:32 thomas Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
......@@ -496,20 +496,20 @@ findFuncByName(FuncInfo *finfo, int numFuncs, const char *name)
* 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.
* uses a static buffer to hold the string. Non-reentrant but faster?
*/
const char *
fmtId(const char *rawid)
fmtId(const char *rawid, bool force_quotes)
{
const char *cp;
static char id[MAXQUERYLEN];
if (! g_force_quotes)
if (! force_quotes)
for (cp = rawid; *cp != '\0'; cp++)
if (!(islower(*cp) || isdigit(*cp) || (*cp == '_')))
break;
if (g_force_quotes || (*cp != '\0'))
if (force_quotes || (*cp != '\0'))
{
strcpy(id, "\"");
strcat(id, rawid);
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_dump.h,v 1.36 1998/12/05 22:09:56 tgl Exp $
* $Id: pg_dump.h,v 1.37 1998/12/13 23:41:32 thomas Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
......@@ -226,7 +226,7 @@ extern void dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
TableInfo *tbinfo, int numTables, const char *tablename);
extern const char *
fmtId(const char *identifier);
fmtId(const char *identifier, bool force_quotes);
/* largest query string size */
#define MAXQUERYLEN 5000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment