keeping 3 tables in sync w/ each other

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: keeping 3 tables in sync w/ each other
Date: 2007-09-18 06:42:32
Message-ID: 1190097752.15849.45.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sascha Bohnenkamp 2007-09-18 07:43:24 Re: keeping 3 tables in sync w/ each other
Previous Message Ow Mun Heng 2007-09-18 06:38:10 Re: help w/ SRF function