Created
August 16, 2023 15:07
-
-
Save denistsyplakov/8d32147b082a78b732575ba01bb38b56 to your computer and use it in GitHub Desktop.
postgres upsert returning only updated rows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------- test upsert with where returning only updated rows----------- | |
create table tmp_fx(code varchar primary key, rate numeric); | |
insert into tmp_fx(code, rate) | |
values (:code, :rate) | |
on conflict (code) do update | |
set rate=excluded.rate | |
where tmp_fx.rate <> excluded.rate | |
returning code; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment