The RETURNING *
in the WITH upsert...
clause has all columns from users
and all columns from the joined table users_import
. So the result has two columns named id
and two columns named name
, hence the ambiguity when refering to upsert.id
.
To avoid that, use RETURNING u.id
if you don't need the rest of the columns.