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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul McGarry <paulm(at)opentec(dot)com(dot)au>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [SQL] MAX() of 0 records.
Date: 2000-07-07 17:12:59
Message-ID: 10917.962989979@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-sql

Paul McGarry <paulm(at)opentec(dot)com(dot)au> writes:
> Would that mean that any update that used an aggregate function
> would be invalid? That would be a bit scary seeing as I am doing
> this in part to get around using aggregate functions in a view.

You'd have to embed the aggregate in a sub-select if we did things
that way. I'd rather not have such a restriction, but only if we can
understand clearly what it means to put an aggregate directly into
UPDATE. The executive summary of what I said before is "exactly what
SHOULD this query do, anyway?" I think it's not well-defined without
some additional assumptions.

>> Another way to look at it is that perhaps an UPDATE involving aggregate
>> functions ought to be implicitly treated as GROUP BY targetTable.ctid.

> What exactly is a ctid?

Physical location of the tuple, expressed as block# and tuple# within
the file. Try "select ctid,* from sometable" ...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2000-07-07 17:59:01 Re: Factorial operator gets parser error in psql.
Previous Message Robert B. Easter 2000-07-07 16:53:27 Re: Re: [HACKERS] Re: [SQL] MAX() of 0 records.

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak 2000-07-07 17:41:14 crypt and MD5 - still not wanted
Previous Message Tom Lane 2000-07-07 17:05:18 Re: Memo on coding practices: strcmp() does not yield bool

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-07-07 17:33:58 Re: Search for underscore w/ LIKE
Previous Message Patrick Coulombe 2000-07-07 16:53:51 order by accents?