Re: Views versus user-defined functions: formatting, comments, performance, etc. - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Views versus user-defined functions: formatting, comments, performance, etc.
Date
Msg-id CAHyXU0wBF2LQHAAq2yx18Zh6EeFG6odtoL6DXBpPurM0eMwbfg@mail.gmail.com
Whole thread Raw
In response to Re: Views versus user-defined functions: formatting, comments, performance, etc.  (Chris Travers <chris.travers@gmail.com>)
List pgsql-general
On Wed, Aug 29, 2012 at 8:52 AM, Chris Travers <chris.travers@gmail.com> wrote:
> ALTER TABLE fruit ADD apple_id int;
> ALTER TABLE fruit ADD FOREIGN KEY (apple_id, type)
>            REFERENCES apple (fruit_id, type)
>            DEFERRABLE INITIALLY DEFERRED;
>
> And then do the same for orange etc.  you can then:
>
> ALTER TABLE fruit ADD CHECK ((type = 'apple' and apple_id IS NOT NULL) OR
> (type = 'orange' AND orange_id IS NOT NULL)
> etc....

Doing the above for me is a 'bridge too far'.  Sure, It's the only way
to make sure the base type is properly specialized but it just sucks.
If there was some way to 'C union' the value into a single column
(there isn't) i'd be all over it...

merlin


pgsql-general by date:

Previous
From: Dmitriy Igrishin
Date:
Subject: Re: C locale versus en_US.UTF8. (Was: String comparision in PostgreSQL)
Next
From: Moshe Jacobson
Date:
Subject: Re: Dropping a column on parent table doesn't propagate to children?