Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7e1a8a9

Browse files
author
Thomas G. Lockhart
committed
Support "delimited identifiers" for \d tablename command.
This allows mixed-case identifiers if surrounded by double quotes. Add mention of "with location" clause for "create database" in help.
1 parent c97f6fd commit 7e1a8a9

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/bin/psql/psql.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.100 1997/11/03 04:21:41 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.101 1997/11/07 06:27:52 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -545,9 +545,19 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
545545

546546
/* Build the query */
547547

548-
for (i = strlen(table); i >= 0; i--)
549-
if (isupper(table[i]))
550-
table[i] = tolower(table[i]);
548+
/* if the table name is surrounded by double-quotes, then don't convert case */
549+
if (*table == '"')
550+
{
551+
table++;
552+
if (*(table+strlen(table)-1) == '"')
553+
*(table+strlen(table)-1) = '\0';
554+
}
555+
else
556+
{
557+
for (i = strlen(table); i >= 0; i--)
558+
if (isupper(table[i]))
559+
table[i] = tolower(table[i]);
560+
}
551561

552562
descbuf[0] = '\0';
553563
strcat(descbuf, "SELECT a.attnum, a.attname, t.typname, a.attlen, a.attnotnull");

src/bin/psql/psqlHelp.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.31 1997/10/16 06:59:23 vadim Exp $
8+
* $Id: psqlHelp.h,v 1.32 1997/11/07 06:27:55 thomas Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -52,14 +52,14 @@ static struct _helpStruct QL_HELP[] = {
5252
"copy data to and from a table",
5353
"copy [binary] <class_name> [with oids]\n\t{to|from} {<filename>|stdin|stdout} [using delimiters <delim>];"},
5454
{"create",
55-
"Please more be specific:",
55+
"Please be more specific:",
5656
"\tcreate aggregate\n\tcreate database\n\tcreate function\n\tcreate index\n\tcreate operator\n\tcreate rule\n\tcreate sequence\n\tcreate table\n\tcreate trigger\n\tcreate type\n\tcreate view"},
5757
{"create aggregate",
5858
"define an aggregate function",
5959
"create aggregate <agg_name> [as] (basetype = <data_type>, \n\t[sfunc1 = <sfunc_1>, stype1 = <sfunc1_return_type>]\n\t[sfunc2 = <sfunc_2>, stype2 = <sfunc2_return_type>]\n\t[,finalfunc = <final-function>]\n\t[,initcond1 = <initial-cond1>][,initcond2 = <initial-cond2>]);"},
6060
{"create database",
6161
"create a database",
62-
"create database <dbname>"},
62+
"create database <dbname> [with location = '<dbpath>']"},
6363
{"create function",
6464
"create a user-defined function",
6565
"create function <function_name> ([<type1>,...<typeN>]) returns <return_type>\n\tas '<object_filename>'|'<sql-queries>'\n\tlanguage 'c'|'sql'|'internal';"},
@@ -94,7 +94,7 @@ static struct _helpStruct QL_HELP[] = {
9494
"delete tuples",
9595
"delete from <class_name> [where <qual>];"},
9696
{"drop",
97-
"Please more be specific:",
97+
"Please be more specific:",
9898
"\tdrop aggregate\n\tdrop database\n\tdrop function\n\tdrop index\n\tdrop operator\n\tdrop rule\n\tdrop sequence\n\tdrop table\n\tdrop trigger\n\tdrop type\n\tdrop view"},
9999
{"drop aggregate",
100100
"remove an aggregate function",

0 commit comments

Comments
 (0)