88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.260 2008/07/1616:54:08 momjian Exp $
11+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.261 2008/07/1619:33:25 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -762,9 +762,6 @@ ExecuteTruncate(TruncateStmt *stmt)
762762ResultRelInfo * resultRelInfo ;
763763ListCell * 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)
774771Relation rel ;
775772
776773rel = 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+ }
777780truncate_check_rel (rel );
778781rels = lappend (rels ,rel );
779782relids = lappend_oid (relids ,RelationGetRelid (rel ));