From: Robert B. Easter <reaster@comptechnews.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Bitmead <chris@bitmead.com>
Cc: pgsql-bugs@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: Re: [HACKERS] Re: [SQL] MAX() of 0 records.
Date: Fri, 7 Jul 2000 12:53:27 -0400
Message-ID: <0007071258480C.01354@comptechnews> (raw)
In-Reply-To: <10551.962987714@sss.pgh.pa.us>
References: <396535EF.8132CF80@opentec.com.au>
<3965F8A6.3322C001@bitmead.com>
<10551.962987714@sss.pgh.pa.us>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: reaster@comptechnews.com, tgl@sss.pgh.pa.us, chris@bitmead.com, pgsql-bugs@postgresql.org, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Re: [SQL] MAX() of 0 records.
In-Reply-To: <0007071258480C.01354@comptechnews>
References: <396535EF.8132CF80@opentec.com.au> <3965F8A6.3322C001@bitmead.com> <10551.962987714@sss.pgh.pa.us> <0007071258480C.01354@comptechnews>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox