Subject Re: [firebird-support] column duplicated in insert statement
Author Ann W. Harrison
Mitchell Peek wrote:
> Found some buggy code that dynamically produced this statement
> Insert into COSTTYPE
> Values
> (1,'TEST','Y','N')
> My tests show that the latter of the two is the value actually used. is
> this always the case? Shouldn't this produce some sort of error?

Yes, the standard is quite clear that a column name should appear in
the insert column list at most once. From its earlier heritage,
Firebird tends to look at an insert statement as a series of assignments
that could include building up to the desired value incrementally using
values that were set by earlier assignments for that target field or
others. The SQL model is that the value is set once and can not be
referenced again in the statement.

So, the answers to your questions are 1) yes, the last value assigned
to a field is the one that will be stored, and 2) the query compiler
should notice and reject insert statements with duplicated insert columns.