Re: [BUGS] Re: [SQL] MAX() of 0 records. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUGS] Re: [SQL] MAX() of 0 records.
Date
Msg-id 10917.962989979@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] MAX() of 0 records.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Paul McGarry <paulm@opentec.com.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Memo on coding practices: strcmp() does not yield bool
Next
From: Karel Zak
Date:
Subject: crypt and MD5 - still not wanted