mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-11 19:20:40 +08:00
Fix previous patch so that it actually works --- consider TRUNCATE foo, public.foo
This commit is contained in:
parent
6563e9e2e8
commit
5ef5abe372
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.260 2008/07/16 16:54:08 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.261 2008/07/16 19:33:25 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -762,9 +762,6 @@ ExecuteTruncate(TruncateStmt *stmt)
|
|||||||
ResultRelInfo *resultRelInfo;
|
ResultRelInfo *resultRelInfo;
|
||||||
ListCell *cell;
|
ListCell *cell;
|
||||||
|
|
||||||
/* make list unique */
|
|
||||||
stmt->relations = list_union(NIL, stmt->relations);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open, exclusive-lock, and check all the explicitly-specified relations
|
* Open, exclusive-lock, and check all the explicitly-specified relations
|
||||||
*/
|
*/
|
||||||
@ -774,6 +771,12 @@ ExecuteTruncate(TruncateStmt *stmt)
|
|||||||
Relation rel;
|
Relation rel;
|
||||||
|
|
||||||
rel = heap_openrv(rv, AccessExclusiveLock);
|
rel = heap_openrv(rv, AccessExclusiveLock);
|
||||||
|
/* don't throw error for "TRUNCATE foo, foo" */
|
||||||
|
if (list_member_oid(relids, RelationGetRelid(rel)))
|
||||||
|
{
|
||||||
|
heap_close(rel, AccessExclusiveLock);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
truncate_check_rel(rel);
|
truncate_check_rel(rel);
|
||||||
rels = lappend(rels, rel);
|
rels = lappend(rels, rel);
|
||||||
relids = lappend_oid(relids, RelationGetRelid(rel));
|
relids = lappend_oid(relids, RelationGetRelid(rel));
|
||||||
|
Loading…
Reference in New Issue
Block a user