Answer the question
In order to leave comments, you need to log in
Can Postgres self-increment when inserting from a select?
There is a Temporary Table , let's call it tmp_tbl , which repeats the structure of the table that needs to be updated (let it be tbl1 ), except for the absence of the id field in the tmp_tbl table - it is an auto-increment in tbl1 . When trying to run a query like this:
WITH tmp as (SELECT * FROM tmp_tbl) INSERT INTO tbl1 (SELECT * FROM tmp)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question