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
|
Список | 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:
- 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.
- 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.
- A better way?
Thanks
В списке pgsql-general по дате отправления: