From d68ccf536e950a07b5a7030bf609936fe65aab51 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 10 Sep 2011 16:39:02 -0400 Subject: [PATCH] Remove double-quoting of table names in clusterdb. BACKWARD COMPABILITY BREAKAGE. Remove double-quoting of index/table names in reindexdb. BACKWARD COMPABILITY BREAKAGE. Document thate user/database names are preserved with double-quoting by command-line tools like vacuumdb. --- doc/src/sgml/ref/createdb.sgml | 7 +++++-- doc/src/sgml/ref/createlang.sgml | 3 ++- doc/src/sgml/ref/droplang.sgml | 1 + doc/src/sgml/reference.sgml | 8 ++++++++ src/bin/scripts/clusterdb.c | 2 +- src/bin/scripts/createlang.c | 1 + src/bin/scripts/droplang.c | 1 + src/bin/scripts/reindexdb.c | 4 ++-- 8 files changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/ref/createdb.sgml b/doc/src/sgml/ref/createdb.sgml index 3e50173e22..1516f3396d 100644 --- a/doc/src/sgml/ref/createdb.sgml +++ b/doc/src/sgml/ref/createdb.sgml @@ -90,7 +90,8 @@ PostgreSQL documentation - Specifies the default tablespace for the database. + Specifies the default tablespace for the database. (This name + is processed as a double-quoted identifier.) @@ -154,6 +155,7 @@ PostgreSQL documentation Specifies the database user who will own the new database. + (This name is processed as a double-quoted identifier.) @@ -163,7 +165,8 @@ PostgreSQL documentation - Specifies the template database from which to build this database. + Specifies the template database from which to build this + database. (This name is processed as a double-quoted identifier.) diff --git a/doc/src/sgml/ref/createlang.sgml b/doc/src/sgml/ref/createlang.sgml index f01f298322..d28cfb772a 100644 --- a/doc/src/sgml/ref/createlang.sgml +++ b/doc/src/sgml/ref/createlang.sgml @@ -70,7 +70,8 @@ PostgreSQL documentation langname - Specifies the name of the procedural language to be installed. + Specifies the name of the procedural language to be + installed. (This name is lower-cased.) diff --git a/doc/src/sgml/ref/droplang.sgml b/doc/src/sgml/ref/droplang.sgml index 04c3a609e5..e5d02aa236 100644 --- a/doc/src/sgml/ref/droplang.sgml +++ b/doc/src/sgml/ref/droplang.sgml @@ -73,6 +73,7 @@ PostgreSQL documentation Specifies the name of the procedural language to be removed. + (This name is lower-cased.) diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml index 9ae80005cd..5fd6410991 100644 --- a/doc/src/sgml/reference.sgml +++ b/doc/src/sgml/reference.sgml @@ -198,6 +198,14 @@ applications is that they can be run on any host, independent of where the database server resides. + + + When specified on the command line, user and databases names have + their case preserved — the presence of spaces or special + characters might require quoting. Table names and other identifiers + do not have their case preserved, except where documented, and + might require quoting. + &clusterdb; diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c index f4c317ae14..3742091e2a 100644 --- a/src/bin/scripts/clusterdb.c +++ b/src/bin/scripts/clusterdb.c @@ -177,7 +177,7 @@ cluster_one_database(const char *dbname, bool verbose, const char *table, if (verbose) appendPQExpBuffer(&sql, " VERBOSE"); if (table) - appendPQExpBuffer(&sql, " %s", fmtId(table)); + appendPQExpBuffer(&sql, " %s", table); appendPQExpBuffer(&sql, ";\n"); conn = connectDatabase(dbname, host, port, username, prompt_password, progname); diff --git a/src/bin/scripts/createlang.c b/src/bin/scripts/createlang.c index c2153db630..2f667e864a 100644 --- a/src/bin/scripts/createlang.c +++ b/src/bin/scripts/createlang.c @@ -164,6 +164,7 @@ main(int argc, char *argv[]) exit(1); } + /* lower case language name */ for (p = langname; *p; p++) if (*p >= 'A' && *p <= 'Z') *p += ('a' - 'A'); diff --git a/src/bin/scripts/droplang.c b/src/bin/scripts/droplang.c index 7fadee0d51..f136a760ff 100644 --- a/src/bin/scripts/droplang.c +++ b/src/bin/scripts/droplang.c @@ -165,6 +165,7 @@ main(int argc, char *argv[]) exit(1); } + /* lower case language name */ for (p = langname; *p; p++) if (*p >= 'A' && *p <= 'Z') *p += ('a' - 'A'); diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index 53fff01a74..caeed7511e 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -223,9 +223,9 @@ reindex_one_database(const char *name, const char *dbname, const char *type, appendPQExpBuffer(&sql, "REINDEX"); if (strcmp(type, "TABLE") == 0) - appendPQExpBuffer(&sql, " TABLE %s", fmtId(name)); + appendPQExpBuffer(&sql, " TABLE %s", name); else if (strcmp(type, "INDEX") == 0) - appendPQExpBuffer(&sql, " INDEX %s", fmtId(name)); + appendPQExpBuffer(&sql, " INDEX %s", name); else if (strcmp(type, "DATABASE") == 0) appendPQExpBuffer(&sql, " DATABASE %s", fmtId(name)); appendPQExpBuffer(&sql, ";\n");