mirror of
https://github.com/postgres/postgres.git
synced 2025-11-13 16:22:44 +03:00
Commit to make clearer distinction for temp names and real names.
Thanks to Tom Lane for ideas.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.107 1999/11/07 23:08:00 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.108 1999/11/16 04:13:55 momjian Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@@ -290,7 +290,7 @@ heap_create(char *relname,
|
||||
* ----------------
|
||||
*/
|
||||
MemSet((char *) rel->rd_rel, 0, sizeof *rel->rd_rel);
|
||||
strcpy(RelationGetRelationName(rel), relname);
|
||||
strcpy(RelationGetPhysicalRelationName(rel), relname);
|
||||
rel->rd_rel->relkind = RELKIND_UNCATALOGED;
|
||||
rel->rd_rel->relnatts = natts;
|
||||
if (tupDesc->constr)
|
||||
@@ -798,7 +798,7 @@ heap_create_with_catalog(char *relname,
|
||||
|
||||
/* temp tables can mask non-temp tables */
|
||||
if ((!istemp && RelnameFindRelid(relname)) ||
|
||||
(istemp && get_temp_rel_by_name(relname) != NULL))
|
||||
(istemp && get_temp_rel_by_username(relname) != NULL))
|
||||
elog(ERROR, "Relation '%s' already exists", relname);
|
||||
|
||||
/* save user relation name because heap_create changes it */
|
||||
@@ -810,7 +810,7 @@ heap_create_with_catalog(char *relname,
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* get_temp_rel_by_name() couldn't check the simultaneous
|
||||
* get_temp_rel_by_username() couldn't check the simultaneous
|
||||
* creation. Uniqueness will be really checked by unique
|
||||
* indexes of system tables but we couldn't check it here.
|
||||
* We have to pospone to create the disk file for this
|
||||
@@ -1448,7 +1448,7 @@ heap_destroy_with_catalog(char *relname)
|
||||
{
|
||||
Relation rel;
|
||||
Oid rid;
|
||||
bool istemp = (get_temp_rel_by_name(relname) != NULL);
|
||||
bool istemp = (get_temp_rel_by_username(relname) != NULL);
|
||||
|
||||
/* ----------------
|
||||
* Open and lock the relation.
|
||||
@@ -1518,9 +1518,6 @@ heap_destroy_with_catalog(char *relname)
|
||||
|
||||
DeleteComments(RelationGetRelid(rel));
|
||||
|
||||
if (istemp)
|
||||
remove_temp_relation(rid);
|
||||
|
||||
/* ----------------
|
||||
* delete type tuple. here we want to see the effects
|
||||
* of the deletions we just did, so we use setheapoverride().
|
||||
@@ -1565,6 +1562,9 @@ heap_destroy_with_catalog(char *relname)
|
||||
* ----------------
|
||||
*/
|
||||
RelationForgetRelation(rid);
|
||||
|
||||
if (istemp)
|
||||
remove_temp_relation(rid);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.94 1999/11/04 08:00:56 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.95 1999/11/16 04:13:55 momjian Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@@ -120,7 +120,7 @@ GetHeapRelationOid(char *heapRelationName, char *indexRelationName, bool istemp)
|
||||
indoid = RelnameFindRelid(indexRelationName);
|
||||
|
||||
if ((!istemp && OidIsValid(indoid)) ||
|
||||
(istemp && get_temp_rel_by_name(indexRelationName) != NULL))
|
||||
(istemp && get_temp_rel_by_username(indexRelationName) != NULL))
|
||||
elog(ERROR, "Cannot create index: '%s' already exists",
|
||||
indexRelationName);
|
||||
|
||||
@@ -948,7 +948,7 @@ index_create(char *heapRelationName,
|
||||
Oid heapoid;
|
||||
Oid indexoid;
|
||||
PredInfo *predInfo;
|
||||
bool istemp = (get_temp_rel_by_name(heapRelationName) != NULL);
|
||||
bool istemp = (get_temp_rel_by_username(heapRelationName) != NULL);
|
||||
char *temp_relname = NULL;
|
||||
|
||||
/* ----------------
|
||||
@@ -1182,9 +1182,6 @@ index_destroy(Oid indexId)
|
||||
}
|
||||
heap_close(attributeRelation, RowExclusiveLock);
|
||||
|
||||
/* does something only if it is a temp index */
|
||||
remove_temp_relation(indexId);
|
||||
|
||||
/* ----------------
|
||||
* fix INDEX relation
|
||||
* ----------------
|
||||
@@ -1211,6 +1208,9 @@ index_destroy(Oid indexId)
|
||||
index_close(userindexRelation);
|
||||
|
||||
RelationForgetRelation(indexId);
|
||||
|
||||
/* does something only if it is a temp index */
|
||||
remove_temp_relation(indexId);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user