Re: what about uniqueness of inherited primary keys

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: what about uniqueness of inherited primary keys
Date: 2003-12-29 15:11:29
Message-ID: 3FF04421.3090906@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Seastian Böck wrote:

> for primary keys there is a simple (and at least working for me)
> solution as long as you can use the SERIAL type for your primary
> key.
> [...]
> Now the id column gets merged and you should have the desired
> behaviour.
>
> If you want objects.id to get referenced by other tables you have
> to work around with triggers and an extra table. For persons.id
> everything is working fine.
>
> This solution (workaround) is only working as long you don't
> insert id-values without updating the corresponding sequence.

Hello Se(b)astian
-- you left out the 'b' in your e-mail setup ;)

right, your proposal does in a way behave like I wanted. Though the idea
of integrity control by the db-server is still not there for parent
id-colomns. Every user or application could mess up the primary key of
the inherited table. That spoils a bit of the oo-approach, I fear.

It wouldn't be that bad, if the table contents weren't merged in SELECTs.

Probaply one could do some trigger-magic to check the inserted id
against an id-pool in another table.
If one knew anything about triggers that is ... well ... miles to go
before I sleep ...

Thanks
Andreas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message lis 2003-12-29 15:16:24 case insensetive UTF-8
Previous Message Ericson Smith 2003-12-29 14:40:38 Re: Is my MySQL Gaining ?