Skip to content

Instantly share code, notes, and snippets.

@JRaspass
Created October 10, 2019 10:32
Show Gist options
  • Select an option

  • Save JRaspass/9e7d19ec7bda4923f2e5d2186ab79beb to your computer and use it in GitHub Desktop.

Select an option

Save JRaspass/9e7d19ec7bda4923f2e5d2186ab79beb to your computer and use it in GitHub Desktop.
db=> truncate account;
TRUNCATE TABLE
db=> with add as (insert into account (oidc, sub) values ('google', 'foo') on conflict do nothing returning id) select * from add union select id from account where oidc = 'google' and sub = 'foo';
11
db=> with add as (insert into account (oidc, sub) values ('google', 'foo') on conflict do nothing returning id) select * from add union select id from account where oidc = 'google' and sub = 'foo';
11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment