Ow Mun Heng wrote:
Hi,
I have 3 tables
foo
foo_loading_source1
foo_loading_source2
which is something like
create table foo (a int, b int, c int)
create table foo_loading_source1 (a int, b int, c int)
create table foo_loading_source2 (a int, b int, c int)
Is there a way which can be made easier to keep these 3 tables DDL in
sync?
the loading_sourceX tables are just a temporary-in-transit table for
data \copy'ied into the DB before being inserted into the main foo
table.
Since these are temporary tables, why don't you just create them on the
fly as temporary tables?
CREATE TEMPORARY TABLE foo_loading_source1 (LIKE foo);
CREATE TEMPORARY TABLE foo_loading_source2 (LIKE foo);
Then do your loading process. Then you don't really have to worry about
maintaining the loading tables at all.
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match