From ce68df468a41d8dbb992184aad490c07d02ca721 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 22 Jul 2010 01:22:35 +0000 Subject: 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. --- src/bin/pg_dump/dumputils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/bin/pg_dump/dumputils.c') diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 124a4586661..64e5b1df104 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -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 { -- cgit v1.2.3