Re: Odd error in complex query (7.2): Sub-SELECT

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Odd error in complex query (7.2): Sub-SELECT
Date: 2001-10-30 03:35:43
Message-ID: 3.0.5.32.20011030143543.02b09870@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 14:36 29/10/01 -0500, Tom Lane wrote:
>Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
>> Sorry for the convoluted example:
>
>A simplified example is

And here's a simpler one that seems to avoid views altogether:

create table lkp(f1 int);
create table t1(f1 int, x int);

Select
case when Exists(Select * From lkp where lkp.f1 = t1.f1) then
'known'
else
'unknown'
end as status,
sum(x)
from t1
group by 1;

It's pretty similar to the sample you gave, but also presents the sort of
operation people may well want to perform.

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2001-10-30 04:35:23 statistics collector
Previous Message Jason L Tibbitts III 2001-10-30 03:14:36 Re: pgsql-committers?