1

In this Postgres query,

INSERT INTO TB_PO
SELECT * FROM temporary_table
ON CONFLICT (id) DO UPDATE 
SET id = excluded.id;

Since both the tables tb_po and temporary_table are identical with 26+ columns, is there a way I can specify after the SET, that it will set all columns of the affected row? So that I don't have to manually input each column with SET. thanks

coldhands
  • 327
  • 1
  • 3
  • 13

1 Answers1

0

You could avoid some typing by generating your statement based on the results of

SELECT column_name 
   FROM information_schema.columns 
   WHERE table_name = 'TB_PO'; 
Gerard H. Pille
  • 2,528
  • 1
  • 13
  • 17