|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.249 2008/03/28 00:21:55 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.250 2008/03/31 03:34:27 tgl Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -662,8 +662,6 @@ ExecuteTruncate(TruncateStmt *stmt) |
662 | 662 | heap_relid=RelationGetRelid(rel); |
663 | 663 | toast_relid=rel->rd_rel->reltoastrelid; |
664 | 664 |
|
665 | | -heap_close(rel,NoLock); |
666 | | - |
667 | 665 | /* |
668 | 666 | * The same for the toast table, if any. |
669 | 667 | */ |
@@ -696,6 +694,14 @@ ExecuteTruncate(TruncateStmt *stmt) |
696 | 694 |
|
697 | 695 | /* We can clean up the EState now */ |
698 | 696 | FreeExecutorState(estate); |
| 697 | + |
| 698 | +/* And close the rels (can't do this while EState still holds refs) */ |
| 699 | +foreach(cell,rels) |
| 700 | +{ |
| 701 | +Relationrel= (Relation)lfirst(cell); |
| 702 | + |
| 703 | +heap_close(rel,NoLock); |
| 704 | +} |
699 | 705 | } |
700 | 706 |
|
701 | 707 | /* |
|