Re: inherited table and rules

From: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
To: Scott Frankel <leknarf(at)pacbell(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: inherited table and rules
Date: 2005-03-23 22:42:03
Message-ID: 4241F0BB3C8.0B19KG@129.180.47.120
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 23 Mar 2005 11:48:46 -0800, Scott Frankel <leknarf(at)pacbell(dot)net> wrote:
>
> Close. Thanks for the very helpful suggestions!
>
> As I read the doco on rules and dissect the rule I've constructed, one
> issue
> remains: the UPDATE in my rule causes additional rows to be added to
> the parent table. How is that possible? How can it be suppressed?

Rows inserted into inherited tables are visible to the parent. It's
effectively the same as having a union all on the 2 tables. Using the
only qualifier is how you stop the "union" happening.

> Here's what my sample code (below) yields:
>
> cs_test=# SELECT * FROM people;

you need to put the only on this query.

Do you really want inheritance or do you just need an table with the
same/similar structure? Maybe people_history should use like instead of
inherits.

klint.

+---------------------------------------+-----------------+
: Klint Gore : "Non rhyming :
: EMail : kg(at)kgb(dot)une(dot)edu(dot)au : slang - the :
: Snail : A.B.R.I. : possibilities :
: Mail University of New England : are useless" :
: Armidale NSW 2351 Australia : L.J.J. :
: Fax : +61 2 6772 5376 : :
+---------------------------------------+-----------------+

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sven Willenberger 2005-03-23 22:45:22 plperl doesn't release memory
Previous Message Lonni J Friedman 2005-03-23 21:25:54 Re: postgres oracle emulation question