Altering same table across multiple databases
-
31-10-2019 - |
Question
I have multiple databases on the same instance and I am in the process of updating a table schema that must propagate across all the databases.
I am not sure I know what the right procedure for this is but I think it should go a little something like this?
DO $$DECLARE r record;
BEGIN
FOR r IN SELECT datname FROM pg_database WHERE datistemplate = false
LOOP
EXECUTE 'ALTER TABLE public.' || quote_ident(r) || ' ALTER VARCHAR(200);';
EXECUTE ...
END LOOP;
END;
$$;
Any thoughts?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange