Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

Next:From: Lee KindnessDate: 2001-10-30 09:15:15
Subject: Re: ecpg - GRANT bug
Previous:From: Dave PageDate: 2001-10-30 08:25:17
Subject: Re: DROP/CREATE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group