keeping 3 tables in sync w/ each other - Mailing list pgsql-general

From Ow Mun Heng
Subject keeping 3 tables in sync w/ each other
Date
Msg-id 1190097752.15849.45.camel@neuromancer.home.net
Whole thread Raw
Responses Re: keeping 3 tables in sync w/ each other
Re: keeping 3 tables in sync w/ each other
Re: keeping 3 tables in sync w/ each other
List pgsql-general
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.

Currently, each time I add a new column to foo, I have to "remember" to
add the same to the other 2 table.

Can I use inheritance? References?

or will I have to create a procedural function such that it will add the
same ddl to all 3 tables each time a new column is defined?



pgsql-general by date:

Previous
From: Ow Mun Heng
Date:
Subject: Re: help w/ SRF function
Next
From: Bill Moseley
Date:
Subject: pgcrypto: is an IV needed with pgp_sym_encrypt()?