AtEOXact_portals();
RecordTransactionAbort();
RelationPurgeLocalRelation(false);
- invalidate_temp_relations();
+ remove_temp_rel_in_myxid();
AtEOXact_SPI();
AtEOXact_nbtree();
AtAbort_Cache();
MaxCommandIdAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
};
-/*
+/*
We decide to call this attribute "tableoid" rather than say
"classoid" on the basis that in the future there may be more than one
table of a particular class/type. In any case table is still the word
-used in SQL.
+used in SQL.
*/
static FormData_pg_attribute a7 = {
0xffffffff, {"tableoid"}, OIDOID, 0, sizeof(Oid),
RelationForgetRelation(rid);
if (istemp)
- remove_temp_relation(rid);
+ remove_temp_rel_by_relid(rid);
if (has_toasttable)
{
RelationForgetRelation(indexId);
/* does something only if it is a temp index */
- remove_temp_relation(indexId);
+ remove_temp_rel_by_relid(indexId);
}
/* ----------------------------------------------------------------
if (!LockClassinfoForUpdate(relid, &tuple, &buffer, confirmCommitted))
elog(ERROR, "IndexesAreActive couldn't lock %u", relid);
if (((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_RELATION &&
- ((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_TOASTVALUE)
+ ((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_TOASTVALUE)
elog(ERROR, "relation %u isn't an indexable relation", relid);
isactive = ((Form_pg_class) GETSTRUCT(&tuple))->relhasindex;
ReleaseBuffer(buffer);
void
remove_all_temp_relations(void)
{
- List *l,
- *next;
-
- if (temp_rels == NIL)
- return;
-
AbortOutOfAnyTransaction();
StartTransactionCommand();
- l = temp_rels;
- while (l != NIL)
+ while (temp_rels != NIL)
{
- TempTable *temp_rel = (TempTable *) lfirst(l);
-
- next = lnext(l); /* do this first, l is deallocated */
+ char relname[NAMEDATALEN];
+ TempTable *temp_rel = (TempTable *) lfirst(temp_rels);
- /* Indexes are dropped during heap drop */
if (temp_rel->relkind != RELKIND_INDEX)
{
- char relname[NAMEDATALEN];
-
/* safe from deallocation */
strcpy(relname, temp_rel->user_relname);
heap_drop_with_catalog(relname, allowSystemTableMods);
}
-
- l = next;
+ else
+ index_drop(temp_rel->relid);
+ CommandCounterIncrement();
}
- temp_rels = NIL;
CommitTransactionCommand();
}
* we don't have the relname for indexes, so we just pass the oid
*/
void
-remove_temp_relation(Oid relid)
+remove_temp_rel_by_relid(Oid relid)
{
MemoryContext oldcxt;
List *l,
* We just have to delete the map entry.
*/
void
-invalidate_temp_relations(void)
+remove_temp_rel_in_myxid(void)
{
MemoryContext oldcxt;
List *l,
extern void create_temp_relation(const char *relname,
HeapTuple pg_class_tuple);
-extern void remove_temp_relation(Oid relid);
+extern void remove_temp_rel_by_relid(Oid relid);
extern bool rename_temp_relation(const char *oldname,
const char *newname);
extern void remove_all_temp_relations(void);
-extern void invalidate_temp_relations(void);
+extern void remove_temp_rel_in_myxid(void);
extern char *get_temp_rel_by_username(const char *user_relname);
extern char *get_temp_rel_by_physicalname(const char *relname);