Postgresql upgrade to 9.5.12/10.3 changes pg_dump format for cloningschemas

Поиск
Список
Период
Сортировка
От Aldrin Martoq Ahumada
Тема Postgresql upgrade to 9.5.12/10.3 changes pg_dump format for cloningschemas
Дата
Msg-id ED39C2F0-21E9-4F7C-B0CF-14A62E78AFD6@gmail.com
обсуждение исходный текст
Ответы Re: Postgresql upgrade to 9.5.12/10.3 changes pg_dump format forcloning schemas
Re: Postgresql upgrade to 9.5.12/10.3 changes pg_dump format forcloning schemas
Список pgsql-general
Hi,

For a multi tenant system, we are using the following command to blindly clone a schema into another:
pg_dump -s -x -O -n #{default_tenant} #{dbname}


This is done for us by a rails gem, which then feeds that script into the new created schema for the new tenant.




When we upgraded from 9.5.11 to 9.5.12, the format of the dump changed (it now always appends the schema name), so this is broken. We could patch the SQL generated, but that’s not a generic/robust solution.

# pg_dump postgresql 9.5.11
SET search_path = public, pg_catalog;
CREATE TABLE ahoy_events (
    id bigint NOT NULL,
    visit_id integer,
    user_id integer,
    name character varying,
    properties jsonb,
    "time" timestamp without time zone
);

# pg_dump postgresql 9.5.12
CREATE TABLE public.ahoy_events (
    id bigint NOT NULL,
    visit_id integer,
    user_id integer,
    name character varying,
    properties jsonb,
    "time" timestamp without time zone
);



Thinking in the long term, how could be the best way to clone a schema into another?




— 
Aldrin

В списке pgsql-general по дате отправления:

Предыдущее
От: wolfgang@alle-noten.de
Дата:
Сообщение: pg/tcl performance related
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Postgresql upgrade to 9.5.12/10.3 changes pg_dump format forcloning schemas