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

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Odd error in complex query (7.2): Sub-SELECT
Date: 2001-10-30 08:43:36
Message-ID: 3BDE6838.286B8A84@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Philip Warner wrote:
>
> 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;
>

A bit off-tppic question, but is our optimiser smart enough to
recognize the query inside exists as LIMIT 1 query ?

------------
Hannu

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lee Kindness 2001-10-30 09:15:15 Re: ecpg - GRANT bug
Previous Message Dave Page 2001-10-30 08:25:17 Re: DROP/CREATE