postgres alter sequence
- How to reset sequence in postgres and fill id column with new data?
ALTER SEQUENCE seq restart WITH 5; UPDATE t SET id = NEXTVAL('seq');
select setval('TABLE_COLUMN_seq'::regclass, (select MAX(COLUMN) FROM TABLE) + 1);
postgres select ... from One select from Another
insert into sip_profiles (profile,type,name,value,enable,active) (select 'external5060', type, name, value, enable, active from sip_profiles where profile='external');
SELECT SETVAL('table_id_seq', (SELECT MAX(id) FROM TABLE));