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

From btober@ct.metrocast.net
Subject Re: keeping 3 tables in sync w/ each other
Date
Msg-id 46EFC675.60706@ct.metrocast.net
Whole thread Raw
In response to keeping 3 tables in sync w/ each other  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Responses Re: keeping 3 tables in sync w/ each other
List pgsql-general
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.




pgsql-general by date:

Previous
From: "Phoenix Kiula"
Date:
Subject: Re: For index bloat: VACUUM ANALYZE vs REINDEX/CLUSTER
Next
From: Devrim GÜNDÜZ
Date:
Subject: New PostgreSQL RPM sets are available for Fedora / RHEL