a guest Oct 23rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- DO $$DECLARE r record;
- FOR r in select distinct(REGEXP_REPLACE(REGEXP_REPLACE(column_default,'nextval\(''',''),'_id_seq''::regclass\)',''))as tabela from information_schema.columns where table_schema = 'cb' and column_default ~'nextval'
- EXECUTE 'ALTER TABLE '|| r.tabela || ' ADD controle_id character varying(80)';
- END LOOP;
RAW Paste Data