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

From Philip Warner
Subject Re: Re: [SQL] MAX() of 0 records.
Date
Msg-id 3.0.5.32.20000710114340.023b56d0@mail.rhyme.com.au
Whole thread Raw
In response to Re: Re: [SQL] MAX() of 0 records.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
At 21:21 9/07/00 -0400, Tom Lane wrote:
>
>> Sounds perfect to me...
>
>Note that it would not meet your expectation that

This seems OK; the 'update...from' syntax does also seemingly implies that
the rows affected will only be those rows that match the predicate, so your
interpretation is probably more in keeping with intuitive expectation.

>
>... 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.

This sounds good, but even when OJ come along, I can't see how I would get
the same behaviour as:
   update t1 set f2=(Select Count(*) from t2 where t2.f1=t1.f1)        where t1.f1 = 2

since in an OJ, count(*) will, I think, always be at least 1.


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.C.N. 008 659 498)             |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

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