Tag Info

New answers tagged


Simple with hstore If you have the additional module hstore installed (instructions in link below), there is a surprisingly simple way to replace the value(s) of individual field(s) without knowing anything about other columns: Basic example: duplicate the row with id = 2 but replace 2 with 3: INSERT INTO people SELECT (p #= '"id"=>"3"'::hstore).* FROM ...


Try to create a trigger on insert: CREATE TRIGGER name BEFORE INSERT In this trigger you make the ID NULL. When the trigger is finished the insert is done and Postgres will provide an ID. I assume that you have defined the ID as DEFAULT NEXTVAL('A_SEQUENCE'::REGCLASS).

Top 50 recent answers are included