Skip to content

Commit 8b53eaf

Browse files
committed
Improve comments.
1 parent be7c0a9 commit 8b53eaf

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/backend/utils/cache/temprel.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.28 2000/10/11 21:28:19 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.29 2000/10/19 23:06:24 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -91,24 +91,37 @@ create_temp_relation(const char *relname, HeapTuple pg_class_tuple)
9191
void
9292
remove_all_temp_relations(void)
9393
{
94+
/* skip xact start overhead if nothing to do */
95+
if (temp_rels == NIL)
96+
return;
97+
9498
AbortOutOfAnyTransaction();
9599
StartTransactionCommand();
96100

101+
/*
102+
* The way this works is that each time through the loop, we delete
103+
* the frontmost entry. The DROP will call remove_temp_rel_by_relid()
104+
* as a side effect, thereby removing the entry in the temp_rels list.
105+
* So this is not an infinite loop, even though it looks like one.
106+
*/
97107
while (temp_rels != NIL)
98108
{
99-
char relname[NAMEDATALEN];
100109
TempTable *temp_rel = (TempTable *) lfirst(temp_rels);
101110

102111
if (temp_rel->relkind != RELKIND_INDEX)
103112
{
113+
char relname[NAMEDATALEN];
114+
104115
/* safe from deallocation */
105116
strcpy(relname, temp_rel->user_relname);
106117
heap_drop_with_catalog(relname, allowSystemTableMods);
107118
}
108119
else
109120
index_drop(temp_rel->relid);
121+
/* advance cmd counter to make catalog changes visible */
110122
CommandCounterIncrement();
111123
}
124+
112125
CommitTransactionCommand();
113126
}
114127

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy