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

From Tom Lane
Subject Re: Re: [SQL] MAX() of 0 records.
Date
Msg-id 13643.963192071@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: [SQL] MAX() of 0 records.  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: Re: [SQL] MAX() of 0 records.
List pgsql-hackers
Philip Warner <pjw@rhyme.com.au> writes:
>> What do people think of my implicit-GROUP-BY-ctid idea?
>> That would basically say that the aggregate is computed over all the
>> tuples that join to a single target tuple.

> Sounds perfect to me...

Note that it would not meet your expectation that
   update t1 set f2=count(*) from t2 where t1.f1=2 and t2.f1=t1.f1 ;

means the same as
   update t1 set f2=(Select Count(*) from t2 where t2.f1=t1.f1) where
t1.f1 = 2

... at least not without some kind of outer-join support too.  With
an inner join, t1 tuples not matching any t2 tuple wouldn't be modified
at all.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: C language function dump problem
Next
From: Philip Warner
Date:
Subject: Re: Re: [SQL] MAX() of 0 records.