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

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

Philip Warner <pjw(at)rhyme(dot)com(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Philip Warner 2000-07-10 01:43:40 Re: [HACKERS] Re: [SQL] MAX() of 0 records.
Previous Message Philip Warner 2000-07-10 00:24:30 Re: [HACKERS] Re: [SQL] MAX() of 0 records.

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2000-07-10 01:43:40 Re: [HACKERS] Re: [SQL] MAX() of 0 records.
Previous Message Tom Lane 2000-07-10 01:13:19 Re: Re: C language function dump problem

Browse pgsql-sql by date

  From Date Subject
Next Message Philip Warner 2000-07-10 01:43:40 Re: [HACKERS] Re: [SQL] MAX() of 0 records.
Previous Message Philip Warner 2000-07-10 00:24:30 Re: [HACKERS] Re: [SQL] MAX() of 0 records.