Re: Using a trigger with an object-relational manager

From: PFC <lists(at)peufeu(dot)com>
To: "Rick Schumeyer" <rschumeyer(at)ieee(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using a trigger with an object-relational manager
Date: 2007-05-23 12:45:49
Message-ID: op.tsr5qnlccigqcu@apollo13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 23 May 2007 14:41:00 +0200, Rick Schumeyer <rschumeyer(at)ieee(dot)org>
wrote:

> Actually, the situation is slightly more complicated. It's more like I
> have tables A1, A2, and A3 each of which must have a corresponding row
> in B. So each of A1, A2 and A3 has a BEFORE INSERT trigger that creates
> a row in B and sets a FK in A1 (or A2 or A3). So I can't just use the
> same PK in both the A tables and B.

It's a hack, but A1, A2, A3 etc could all use the same sequence to
generate their PK...

The best would be to patch rails so it uses INSERT RETURNING.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message J. ORIOL 2007-05-23 12:50:42 Several queries consume 100 % processor
Previous Message Rick Schumeyer 2007-05-23 12:41:00 Re: Using a trigger with an object-relational manager