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.
This commit is contained in:
Thomas G. Lockhart 1997-11-07 06:27:55 +00:00
parent c97f6fd197
commit 7e1a8a90f8
2 changed files with 18 additions and 8 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.100 1997/11/03 04:21:41 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.101 1997/11/07 06:27:52 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -545,9 +545,19 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
/* Build the query */ /* Build the query */
for (i = strlen(table); i >= 0; i--) /* if the table name is surrounded by double-quotes, then don't convert case */
if (isupper(table[i])) if (*table == '"')
table[i] = tolower(table[i]); {
table++;
if (*(table+strlen(table)-1) == '"')
*(table+strlen(table)-1) = '\0';
}
else
{
for (i = strlen(table); i >= 0; i--)
if (isupper(table[i]))
table[i] = tolower(table[i]);
}
descbuf[0] = '\0'; descbuf[0] = '\0';
strcat(descbuf, "SELECT a.attnum, a.attname, t.typname, a.attlen, a.attnotnull"); strcat(descbuf, "SELECT a.attnum, a.attname, t.typname, a.attlen, a.attnotnull");

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: psqlHelp.h,v 1.31 1997/10/16 06:59:23 vadim Exp $ * $Id: psqlHelp.h,v 1.32 1997/11/07 06:27:55 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -52,14 +52,14 @@ static struct _helpStruct QL_HELP[] = {
"copy data to and from a table", "copy data to and from a table",
"copy [binary] <class_name> [with oids]\n\t{to|from} {<filename>|stdin|stdout} [using delimiters <delim>];"}, "copy [binary] <class_name> [with oids]\n\t{to|from} {<filename>|stdin|stdout} [using delimiters <delim>];"},
{"create", {"create",
"Please more be specific:", "Please be more specific:",
"\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"}, "\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"},
{"create aggregate", {"create aggregate",
"define an aggregate function", "define an aggregate function",
"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>]);"}, "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>]);"},
{"create database", {"create database",
"create a database", "create a database",
"create database <dbname>"}, "create database <dbname> [with location = '<dbpath>']"},
{"create function", {"create function",
"create a user-defined function", "create a user-defined function",
"create function <function_name> ([<type1>,...<typeN>]) returns <return_type>\n\tas '<object_filename>'|'<sql-queries>'\n\tlanguage 'c'|'sql'|'internal';"}, "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[] = {
"delete tuples", "delete tuples",
"delete from <class_name> [where <qual>];"}, "delete from <class_name> [where <qual>];"},
{"drop", {"drop",
"Please more be specific:", "Please be more specific:",
"\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"}, "\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"},
{"drop aggregate", {"drop aggregate",
"remove an aggregate function", "remove an aggregate function",