1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Add options to force quoting of all identifiers.

I've added a quote_all_identifiers GUC which affects the behavior
of the backend, and a --quote-all-identifiers argument to pg_dump
and pg_dumpall which sets the GUC and also affects the quoting done
internally by those applications.

Design by Tom Lane; review by Alex Hunsaker; in response to bug #5488
filed by Hartmut Goebel.
This commit is contained in:
Robert Haas
2010-07-22 01:22:35 +00:00
parent b8c6c71d1c
commit ce68df468a
11 changed files with 85 additions and 11 deletions

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.56 2010/03/03 20:10:48 heikki Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.57 2010/07/22 01:22:34 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@ -36,6 +36,8 @@ static bool parallel_init_done = false;
static DWORD tls_index;
#endif
int quote_all_identifiers;
void
init_parallel_dump_utils(void)
{
@ -102,8 +104,10 @@ fmtId(const char *rawid)
* These checks need to match the identifier production in scan.l. Don't
* use islower() etc.
*/
if (quote_all_identifiers)
need_quotes = true;
/* slightly different rules for first character */
if (!((rawid[0] >= 'a' && rawid[0] <= 'z') || rawid[0] == '_'))
else if (!((rawid[0] >= 'a' && rawid[0] <= 'z') || rawid[0] == '_'))
need_quotes = true;
else
{