Ouch. Inheritance hurts

From: Geoff Russell <geoff(at)austrics(dot)com(dot)au>
To: PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Ouch. Inheritance hurts
Date: 2001-03-05 22:27:51
Message-ID: Pine.GSO.4.05.10103060848440.11301-100000@slayer
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Now I know its my own fault but I was using inheritance to get similar tables.

create table members ( XXX );
create table members_history ( XXX , YYY ) inherits (members);

Then I copied deleted/updated records to the history file with a trigger.
On 7.1 this has the disturbing problem that all my SELECTS from members give
me the history records as well. Yes I can go through adding ONLY to all
the SELECT statements but I have another suggestion. How about:

create table members ( XXX );
create table members_history ( XXX , YYY ) like (members);

and have this syntax preserve the 7.0 behaviour?

As it is, if I don't want to use the ONLY keyword, then I need to recreate
all my history files with new definitions, and then I need to worry about
keeping the definitions in sync as time goes on and fields are added.

Cheers,
Geoff

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6 Fifth Ave +618-8332-5069 (Home) |
St Morris SA 5068 +618-8207-2029 (Work) | geoff(at)austrics(dot)com(dot)au
Adelaide, AUSTRALIA +618-8364-1543 (Fax-Home) |

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2001-03-05 22:40:57 Re: Getting lengths of variable fields
Previous Message Chris 2001-03-05 22:20:25 Re: RPMs for PHP accessing PostgreSQL via ODBC over RedHat