We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given a table definition such as :
create table sample_relation ( id text not null, b_id int not null, c_id int, unique(id, b_id, c_id), foreign key (id) references sample_relation_2(id), foreign key (b_id) references sample_relation_3(id), foreign key (c_id) references sample_relation_3(id) );
and a partial unique index defined on it :
create unique index idx_sample_relation_id_b_id on sample_relation(id, b_id) where c_id is null;
I would like to UPSERT some data. I have tried doing that in the following way :
(sql/sql (sql/insert db :sample-relation [] (sql/values {:id "abc" :b-id 1 :c-id 2}) (sql/on-conflict [:id :b-id] (sql/where '(is-null c-id)) (sql/do-update {:c-id :EXCLUDED.c-id}))))
which should translate to this query :
insert into sample_relation(id, b_id, c_id) values ('abc', 1, 2) on conflict (id, b_id) where c_id is null do update set c_id = EXCLUDED.c_id;
but instead wrongly translates to (Note the position of the WHERE clause) :
WHERE
insert into sample_relation(id, b_id, c_id) values ('abc', 1, 2) on conflict (id, b_id) do update set c_id = EXCLUDED.c_id where c_id is null;
which in turn gives me the error :
column reference "c_id" is ambiguous
Is my syntax wrong or is this a bug?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Given a table definition such as :
and a partial unique index defined on it :
I would like to UPSERT some data. I have tried doing that in the following way :
which should translate to this query :
but instead wrongly translates to (Note the position of the
WHERE
clause) :which in turn gives me the error :
Is my syntax wrong or is this a bug?
The text was updated successfully, but these errors were encountered: