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

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:43:40
Message-ID: 3.0.5.32.20000710114340.023b56d0@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-sql

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Karel Zak 2000-07-10 06:42:31 Re: [HACKERS] Re: Unnexpected results using to_number()
Previous Message Tom Lane 2000-07-10 01:21:11 Re: [HACKERS] Re: [SQL] MAX() of 0 records.

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2000-07-10 02:05:23 Re: Re: C language function dump problem
Previous Message Tom Lane 2000-07-10 01:21:11 Re: [HACKERS] Re: [SQL] MAX() of 0 records.

Browse pgsql-sql by date

  From Date Subject
Next Message Paulo Roberto Siqueira 2000-07-10 01:49:14 CREATE TABLE with foreign key and primary key
Previous Message Tom Lane 2000-07-10 01:21:11 Re: [HACKERS] Re: [SQL] MAX() of 0 records.