diff options
author | Thomas G. Lockhart <lockhart@fourpalms.org> | 2000-08-06 17:50:48 +0000 |
---|---|---|
committer | Thomas G. Lockhart <lockhart@fourpalms.org> | 2000-08-06 17:50:48 +0000 |
commit | df40234639905eb891a0ef92ed13efe31d6aa316 (patch) | |
tree | cfb5e0b21801e9a4c1cedd11061d46b82c41dc4d /src/bin/pg_dump/common.c | |
parent | c3e2a951b496f8030442f157b201cbddab5b5662 (diff) |
Support SQL99 embedded double-quote syntax for quoted identifiers.
Allow this in the parser and in pg_dump, but it is probably not enough
for a complete solution.
Better to have the feature started then never here.
Diffstat (limited to 'src/bin/pg_dump/common.c')
-rw-r--r-- | src/bin/pg_dump/common.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 4e3244f5a5a..d7cb9e488a5 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.44 2000/07/04 14:25:27 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.45 2000/08/06 17:50:48 thomas Exp $ * * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * @@ -517,8 +517,10 @@ fmtId(const char *rawid, bool force_quotes) if (!force_quotes) { + /* do a quick check on the first character... */ if (!islower((int) *rawid)) force_quotes = true; + /* otherwise check the entire string */ else for (cp = rawid; *cp; cp++) { @@ -541,8 +543,15 @@ fmtId(const char *rawid, bool force_quotes) appendPQExpBufferChar(id_return, '\"'); for (cp = rawid; *cp; cp++) { + /* Did we find a double-quote in the string? + * Then make this a double double-quote per SQL99. + * Before, we put in a backslash/double-quote pair. + * - thomas 2000-08-05 */ if (*cp == '\"') - appendPQExpBufferChar(id_return, '\\'); + { + appendPQExpBufferChar(id_return, '\"'); + appendPQExpBufferChar(id_return, '\"'); + } appendPQExpBufferChar(id_return, *cp); } appendPQExpBufferChar(id_return, '\"'); |