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

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Views versus user-defined functions: formatting, comments, performance, etc.
Дата
Msg-id CAHyXU0wBF2LQHAAq2yx18Zh6EeFG6odtoL6DXBpPurM0eMwbfg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Views versus user-defined functions: formatting, comments, performance, etc.  (Chris Travers <chris.travers@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Dmitriy Igrishin
Дата:
Сообщение: Re: C locale versus en_US.UTF8. (Was: String comparision in PostgreSQL)
Следующее
От: Moshe Jacobson
Дата:
Сообщение: Re: Dropping a column on parent table doesn't propagate to children?