Re: Views versus user-defined functions: formatting, comments, performance, etc.

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Chris Travers <chris(dot)travers(at)gmail(dot)com>
Cc: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Adam Mackler <adammackler(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Views versus user-defined functions: formatting, comments, performance, etc.
Date: 2012-08-29 19:22:15
Message-ID: CAHyXU0wBF2LQHAAq2yx18Zh6EeFG6odtoL6DXBpPurM0eMwbfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Aug 29, 2012 at 8:52 AM, Chris Travers <chris(dot)travers(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Moshe Jacobson 2012-08-29 19:39:27 Re: Dropping a column on parent table doesn't propagate to children?
Previous Message Dmitriy Igrishin 2012-08-29 19:14:04 Re: C locale versus en_US.UTF8. (Was: String comparision in PostgreSQL)