Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux