Skip to content

Commit 5ef5abe

Browse files
committed
Fix previous patch so that it actually works --- consider TRUNCATE foo, public.foo
1 parent 6563e9e commit 5ef5abe

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/backend/commands/tablecmds.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.260 2008/07/16 16:54:08 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.261 2008/07/16 19:33:25 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -762,9 +762,6 @@ ExecuteTruncate(TruncateStmt *stmt)
762762
ResultRelInfo *resultRelInfo;
763763
ListCell *cell;
764764

765-
/* make list unique */
766-
stmt->relations = list_union(NIL, stmt->relations);
767-
768765
/*
769766
* Open, exclusive-lock, and check all the explicitly-specified relations
770767
*/
@@ -774,6 +771,12 @@ ExecuteTruncate(TruncateStmt *stmt)
774771
Relation rel;
775772

776773
rel = heap_openrv(rv, AccessExclusiveLock);
774+
/* don't throw error for "TRUNCATE foo, foo" */
775+
if (list_member_oid(relids, RelationGetRelid(rel)))
776+
{
777+
heap_close(rel, AccessExclusiveLock);
778+
continue;
779+
}
777780
truncate_check_rel(rel);
778781
rels = lappend(rels, rel);
779782
relids = lappend_oid(relids, RelationGetRelid(rel));

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