Функция plpgsql с циклом по таблице change_request
create or replace function change_request() returns void as $$ DECLARE r record; BEGIN for r in select * from change_request loop execute format('ALTER TABLE %I ADD COLUMN %I %s', r.table_name, r.column_name, r.column_type); end loop; END $$ language plpgsql;