create temp table foo (name text unique); insert into foo values ('name1') on conflict(name) do nothing returning *; -->output: name1 insert into foo values ('name1') on conflict(name) do nothing returning *; -->output: no output here drop table foo; create temp table foo (name text unique, amount int); insert into foo values ('name1', 0) on conflict(name) do update set amount=excluded.amount returning *; -->output: name1|0 insert into foo values ('name1', 1) on conflict(name) do update set amount=excluded.amount returning *; -->output: no output here Thanks.