Re: Implementing automatic updating of primary keys...

From: Bhuvan A <bhuvansql(at)myrealbox(dot)com>
To: "Rajesh Kumar Mallah(dot)" <mallah(at)trade-india(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Implementing automatic updating of primary keys...
Date: 2003-01-20 09:55:36
Message-ID: Pine.LNX.4.44.0301201515100.11065-100000@Bhuvan.bksys.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> there can be many such tables that have foreign key id which is referencing
> the master table test_master column "id". what we want is when some ids become
^^^^^^^^^^^
It should be profile_master, right?

> redundant we have to merge two ids , we want that thru out the system the
> occurance of the old primary key shud be removed and replaced with the new id.
>

Definitely it can be done in the database level. Trigger a function before
delete on the primary table (profile_master) and update the foreign tables
with appropriate id and so the redundant id can be deleted from the
primary table.

regards,
bhuvaneswaran

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Moritz Lennert 2003-01-20 11:40:13 performance question
Previous Message Bhuvan A 2003-01-20 09:37:18 Re: pg_dump problem