Re: Checking number of entries

Поиск
Список
Период
Сортировка
От Philip Warner
Тема Re: Checking number of entries
Дата
Msg-id 3.0.5.32.20000930235242.02b43b00@mail.rhyme.com.au
обсуждение исходный текст
Ответ на Re: Checking number of entries  (Philip Warner <pjw@rhyme.com.au>)
Ответы Re: Checking number of entries  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
At 18:09 29/09/00 -0700, Stephan Szabo wrote:
>
>How do other systems (Oracle, etc...) handle the subselect and arbitrary
>function cases?
>

Dec RDB seems to go the distance. With the following incredibly silly
constraint:

alter table zzz add constraint
     check( (select sum(zzzz.f1*zzz1.f1_1) from zzzz,zzz1
                where zzzz.f2=zzz1.f1_1) + f1 > 0);

Any updates to the referenced tables cause it to run a query that *seems*
to be:

     select * from ZZZ where not ( <constraint-condition> )

This is my guess based on the optimizer output, but it seems reasonable.

An update to the main table causes the same query to be executed but only
for the updated row.

Adding the main table to the check query produces a similar result.


This may be a useful general model? Is there a problem with the approach?
It couls be further improved by using 'limit 1', but otherwise seems good...





----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|
                                 |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/

В списке pgsql-general по дате отправления:

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: RE:Redhat 7 And Pgsql
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Checking number of entries