mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Additional fixes for mixed-case table names from Billy Allie.
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.65 1998/11/12 15:39:06 thomas Exp $
|
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.66 1998/11/17 14:26:39 thomas Exp $
|
||||||
*
|
*
|
||||||
* INTERFACE ROUTINES
|
* INTERFACE ROUTINES
|
||||||
* heap_create() - Create an uncataloged heap relation
|
* heap_create() - Create an uncataloged heap relation
|
||||||
@ -1444,7 +1444,10 @@ StoreAttrDefault(Relation rel, AttrDefault *attrdef)
|
|||||||
extern GlobalMemory CacheCxt;
|
extern GlobalMemory CacheCxt;
|
||||||
|
|
||||||
start:;
|
start:;
|
||||||
sprintf(str, "select %s%s from %.*s", attrdef->adsrc, cast,
|
/* Surround table name with double quotes to allow mixed-case and
|
||||||
|
* whitespaces in names. - BGA 1998-11-14
|
||||||
|
*/
|
||||||
|
sprintf(str, "select %s%s from \"%.*s\"", attrdef->adsrc, cast,
|
||||||
NAMEDATALEN, rel->rd_rel->relname.data);
|
NAMEDATALEN, rel->rd_rel->relname.data);
|
||||||
setheapoverride(true);
|
setheapoverride(true);
|
||||||
planTree_list = (List *) pg_parse_and_plan(str, NULL, 0, &queryTree_list, None, FALSE);
|
planTree_list = (List *) pg_parse_and_plan(str, NULL, 0, &queryTree_list, None, FALSE);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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.164 1998/11/17 14:26:31 thomas Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -460,12 +460,17 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type,
|
|||||||
perror("malloc");
|
perror("malloc");
|
||||||
|
|
||||||
/* load table table */
|
/* 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++)
|
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)
|
if (table[i] == NULL)
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
strcpy(table[i], PQgetvalue(res, i, 1));
|
strcpy(table[i], "\"");
|
||||||
|
strcat(table[i], PQgetvalue(res, i, 1));
|
||||||
|
strcat(table[i], "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
Reference in New Issue
Block a user