SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DO $$DECLARE r record;
  2. BEGIN
  3.     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'
  4.     LOOP
  5.        
  6.         EXECUTE 'ALTER TABLE '|| r.tabela || ' ADD controle_id  character varying(80)';
  7.        
  8.     END LOOP;
  9. END$$;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top