Re: syncing a serial across tables

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: syncing a serial across tables
Date: 2005-05-12 18:14:15
Message-ID: 20050512181415.GA29389@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, May 12, 2005 at 21:02:31 +0300,
Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com> wrote:
> Hi,
>
> On 5/12/05, Keith Worthington <keithw(at)narrowpathinc(dot)com> wrote:
> > I believe I need to use a serial column in two tables and keep then synched.
> > I am thinking that I could use an AFTER INSERT trigger and INSERT currval()
> > into the second table to keep them synched. Has anyone done this before? Is
> > this a bad idea?
>
> If both columns in both table will have the same value, why don't you
> just reference one to another? This will keep synchorization
> automaticly.

If they really are supposed to be 1 to 1, then the references will need
to go both ways.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2005-05-12 19:31:07 Re: [NOVICE] Using PgSQL in high volume and throughput problem
Previous Message Volkan YAZICI 2005-05-12 18:02:31 Re: syncing a serial across tables