Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E0010 duplicate-target-column

Column given twice in an INSERT column list or UPDATE SET.

CodeNameCategoryDefault
E0010duplicate-target-columncorrectnesserror

What it reports

An INSERT column list names a column twice, or UPDATE ... SET (or ON CONFLICT DO UPDATE SET) assigns a column twice. The database rejects the statement instead of picking one of the values.

Example

UPDATE orders SET status = 'paid', status = 'shipped' WHERE id = 1;
error[E0010]: Column 'status' is assigned more than once
  --> q.sql:1:36
    |
  1 | UPDATE orders SET status = 'paid', status = 'shipped' WHERE id = 1;
    |                                    ^^^^^^
    = help: Remove one of the assignments

Fixed:

UPDATE orders SET status = 'shipped' WHERE id = 1;

Notes

Repeated INSERT columns are reported for PostgreSQL, Redshift and MySQL; repeated SET assignments for PostgreSQL and Redshift only, since MySQL and SQLite apply them in order. Assignments to fields of a composite column (SET c.f1 = 1, c.f2 = 2) are not repeats.

Configuring

# sqlsift.toml
[rules]
duplicate-target-column = "warn"   # or "off"

Or for a single line: -- sqlsift:disable E0010. The examples use the schema on the Rules page.