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

From: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Chris Bitmead <chris(at)bitmead(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [HACKERS] Re: [SQL] MAX() of 0 records.
Date: 2000-07-07 16:53:27
Message-ID: 0007071258480C.01354@comptechnews
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-sql

On Fri, 07 Jul 2000, Tom Lane wrote:
> Chris Bitmead <chris(at)bitmead(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2000-07-07 17:12:59 Re: Re: [SQL] MAX() of 0 records.
Previous Message Bruce Momjian 2000-07-07 16:35:37 Re: Factorial operator gets parser error in psql.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-07-07 17:05:18 Re: Memo on coding practices: strcmp() does not yield bool
Previous Message Tom Lane 2000-07-07 16:52:29 Re: Re: [SQL] Re: [GENERAL] lztext and compression ratios...

Browse pgsql-sql by date

  From Date Subject
Next Message Patrick Coulombe 2000-07-07 16:53:51 order by accents?
Previous Message Tom Lane 2000-07-07 16:52:29 Re: Re: [SQL] Re: [GENERAL] lztext and compression ratios...