Re: DB migration : Sybase to Postgres

Поиск
Список
Период
Сортировка
От Marcos Pegoraro
Тема Re: DB migration : Sybase to Postgres
Дата
Msg-id CAB-JLwZdCDV6OhZyR5282svD0=mMYfHj8E7Kipk6uF-PbLyB4Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: DB migration : Sybase to Postgres  (Sengottaiyan T <techsenko@gmail.com>)
Список pgsql-general
Em qui., 25 de mai. de 2023 às 08:30, Sengottaiyan T <techsenko@gmail.com> escreveu:
Is there an option to set novalidate constraints in postgres? In my source Sybase DB, table structures are not defined properly (only primary keys exist and no foreign key) - I'm making necessary changes on target Postgres DB (created tables, identifying relationship between table columns with respective team). After creating proper structure on target, the next step is to load data - I'm sure there will be a lot of errors during initial data load (no parent record found). How to handle it?

Other options:

create all foreign keys before importing your data and do ...

This way table triggers are disabled for all users;
ALTER TABLE T1 DISABLE TRIGGER ALL; ALTER TABLE T2 DISABLE TRIGGER ALL; ALTER TABLE T3 DISABLE TRIGGER ALL;
--Import all your data
ALTER TABLE T1 ENABLE TRIGGER ALL; ALTER TABLE T2 ENABLE TRIGGER ALL; ALTER TABLE T3 ENABLE TRIGGER ALL;

or

This way table triggers are disabled for this session only;
SET SESSION_REPLICATION_ROLE = REPLICA;
--Import all your data
SET SESSION_REPLICATION_ROLE = ORIGIN;

Obviously if your data doesn't have correct foreign keys matching to their parent you'll never be able to do a dump/restore properly.

Marcos

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

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Having issue with SSL.
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: DB migration : Sybase to Postgres