Re: inherited table and rules - Mailing list pgsql-general

From Klint Gore
Subject Re: inherited table and rules
Date
Msg-id 4241F0BB3C8.0B19KG@129.180.47.120
Whole thread Raw
In response to Re: inherited table and rules  (Scott Frankel <leknarf@pacbell.net>)
Responses Re: inherited table and rules
List pgsql-general
On Wed, 23 Mar 2005 11:48:46 -0800, Scott Frankel <leknarf@pacbell.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@kgb.une.edu.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             :                 :
+---------------------------------------+-----------------+

pgsql-general by date:

Previous
From: Lonni J Friedman
Date:
Subject: Re: postgres oracle emulation question
Next
From: Sven Willenberger
Date:
Subject: plperl doesn't release memory