Re: [BUGS] Re: Re: [SQL] MAX() of 0 records.

Поиск
Список
Период
Сортировка
От Robert B. Easter
Тема Re: [BUGS] Re: Re: [SQL] MAX() of 0 records.
Дата
Msg-id 0007071258480C.01354@comptechnews
обсуждение исходный текст
Ответ на Re: [BUGS] Re: Re: [SQL] MAX() of 0 records.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [BUGS] Re: Re: [SQL] MAX() of 0 records.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, 07 Jul 2000, Tom Lane wrote:
> Chris Bitmead <chris@bitmead.com> writes:
>     UPDATE foo
>     SET bar = (SELECT min(f1) FROM othertab
>                WHERE othertab.keycol = foo.keycol)
>     WHERE condition-determining-which-foo-rows-to-update
> if you wanted to use an aggregate.  This is pretty ugly, especially so

If you use min(x) or max(x) frequently, isn't it best to make a trigger that
intercepts x on insert and update, then check it and store it somewhere rather
than scanning for it everytime?  (not that this fixes any db problem thats being
discussed here)
--         Robert


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Re: [SQL] Re: [GENERAL] lztext and compression ratios...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Memo on coding practices: strcmp() does not yield bool