Can one automatically add a column to tables from a foreign schema to indicate their origin so they can later be partitioned by when creating an aggregate table?
Is it possible to set up a foreign data wrapper to a table, or ideally an entire schema, and automatically add a column to all tables indicating the origin of the foreign table?
I.e., looking at the diagram here (from Geographically distributed Postgres for multi-tenant applications)
would it be possible to have the controller node add us_east1
and eu_central1
to all tables ingested from each server?
Or is the only solution to add a region
column to every table that might make it to the controller node? I’m guessing this could be solved with a view and some plpgsql
to create those fews but I’m wondering if there’s something in the toolbox here already that I’m missing.