Logical Replication - Single Destination Table With Multiple Source Tables - How to Handle Structure Changes

Поиск
Список
Период
Сортировка
От Avi Weinberg
Тема Logical Replication - Single Destination Table With Multiple Source Tables - How to Handle Structure Changes
Дата
Msg-id DB9PR07MB71801CEC6FA8E61D233808C8CB1D9@DB9PR07MB7180.eurprd07.prod.outlook.com
обсуждение исходный текст
Ответы Re: Logical Replication - Single Destination Table With Multiple Source Tables - How to Handle Structure Changes  (Vijaykumar Jain <vijaykumarjain.github@gmail.com>)
Список pgsql-general

I'm using logical replication to copy data from multiple tables to a single destination table.  At times the structure of the source table needs to change.  However, not all source table will have their structure updated at the same time.  Let's assume, for example, a column type needs to be changed (but solution needs to work for column addition, deletion, rename etc.).  What is the preferable approach:

 

  1. To add another column to the destination table where its type will be the new type.  Source tables, that have the new column type, will write to the new column.  While source tables with old column type will write to the old column.  A view will do the proper casting and will show a single column to user.
  2. Add a new table (versioned: table_name_v2) where source tables that have a new structure will write to the new destination table, while old source tables will write to the old destination table.   A view with UNION and casting will combine all tables.
  3. A better way?

 

 

Thanks

IMPORTANT - This email and any attachments is intended for the above named addressee(s), and may contain information which is confidential or privileged. If you are not the intended recipient, please inform the sender immediately and delete this email: you should not copy or use this e-mail for any purpose nor disclose its contents to any person.

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

Предыдущее
От: Ray O'Donnell
Дата:
Сообщение: Re: Overlapping timestamptz ranges with priority
Следующее
От: Vijaykumar Jain
Дата:
Сообщение: Re: Logical Replication - Single Destination Table With Multiple Source Tables - How to Handle Structure Changes