I have a simple table in PostgreSQL that has three columns:
I have already see
with vals as ( select 'key5' as key, 'value2' as value ) insert into Test1 (key, value) select v.key, v.value from vals as v where not exists (select * from Test1 as t where t.key = v.key and t.value = v.value) returning id
sql fiddle demo