Insert records from one table to other with default serial
0
votes
2
answers
1178
views
I have two tables with same structure, first column gid as serial, and many other columns after that. I want to insert selected rows from one table to the other. Without serial it is really easy:
insert into all_roads select * from new_roads where add_road = 1;
But with serial as first column in both I do get error:
ERROR: duplicate key value violates unique constraint
I really do not want to copy serial number from one table to the other. I rather use default serial value for all new inserted records. Is there a way without writing insert which manually lists all the columns except the first - serial?
Asked by Miro
(101 rep)
Nov 21, 2019, 02:03 AM
Last activity: Feb 13, 2025, 09:05 AM
Last activity: Feb 13, 2025, 09:05 AM