88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.129 2005/01/13 17:19:09 tgl Exp $
11+ * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.130 2005/03/26 06:28:59 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
1515#include "postgres.h"
1616
1717#include "commands/dbcommands.h"
1818#include "miscadmin.h"
19+ #include "nodes/bitmapset.h"
1920#include "nodes/makefuncs.h"
2021#include "parser/parsetree.h"
2122#include "parser/parse_coerce.h"
@@ -630,7 +631,8 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
630631/*
631632 * Do initial validation of user-supplied INSERT column list.
632633 */
633- List * wholecols = NIL ;
634+ Bitmapset * wholecols = NULL ;
635+ Bitmapset * partialcols = NULL ;
634636ListCell * tl ;
635637
636638foreach (tl ,cols )
@@ -649,21 +651,23 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
649651if (col -> indirection == NIL )
650652{
651653/* whole column; must not have any other assignment */
652- if (list_member_int (* attrnos ,attrno ))
654+ if (bms_is_member (attrno ,wholecols )||
655+ bms_is_member (attrno ,partialcols ))
653656ereport (ERROR ,
654657(errcode (ERRCODE_DUPLICATE_COLUMN ),
655658errmsg ("column \"%s\" specified more than once" ,
656659name )));
657- wholecols = lappend_int (wholecols ,attrno );
660+ wholecols = bms_add_member (wholecols ,attrno );
658661}
659662else
660663{
661664/* partial column; must not have any whole assignment */
662- if (list_member_int ( wholecols , attrno ))
665+ if (bms_is_member ( attrno , wholecols ))
663666ereport (ERROR ,
664667(errcode (ERRCODE_DUPLICATE_COLUMN ),
665668errmsg ("column \"%s\" specified more than once" ,
666669name )));
670+ partialcols = bms_add_member (partialcols ,attrno );
667671}
668672
669673* attrnos = lappend_int (* attrnos ,attrno );