summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas G. Lockhart1998-11-24 05:50:42 +0000
committerThomas G. Lockhart1998-11-24 05:50:42 +0000
commit65a898b520c439ba1867222902b009c24097ab18 (patch)
tree828cf1bb4f916bccdb1f1e37e277b3f686a5c2be
parent43ea370fcf72ccb0bac72e01f4e71a8de68a5872 (diff)
Additional fixes for mixed-case table names from Billy Allie.
Same changes I tried to commit last time. Hope the new version of cvs keeps it down...
-rw-r--r--src/bin/psql/psql.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bin/psql/psql.c b/src/bin/psql/psql.c
index a5d6cfa0061..de9339d8eef 100644
--- a/src/bin/psql/psql.c
+++ b/src/bin/psql/psql.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.163 1998/10/26 01:04:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.163.2.1 1998/11/24 05:50:42 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -460,12 +460,17 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type,
perror("malloc");
/* load table table */
+ /* Put double quotes around the table name to allow for mixed-case
+ * and whitespaces in the table name. - BGA 1998-11-14
+ */
for (i = 0; i < nColumns; i++)
{
- table[i] = (char *) malloc(PQgetlength(res, i, 1) * sizeof(char) + 1);
+ table[i] = (char *) malloc(PQgetlength(res, i, 1) * sizeof(char) + 3);
if (table[i] == NULL)
perror("malloc");
- strcpy(table[i], PQgetvalue(res, i, 1));
+ strcpy(table[i], "\"");
+ strcat(table[i], PQgetvalue(res, i, 1));
+ strcat(table[i], "\"");
}
PQclear(res);