Re: SELECT does not find table created by itself

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Magnus Hagander *EXTERN*" <magnus(at)hagander(dot)net>, "Andrus" <kobruleht2(at)hot(dot)ee>
Cc: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT does not find table created by itself
Date: 2010-01-04 12:41:31
Message-ID: D960CB61B694CF459DCFB4B0128514C203938104@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Magnus Hagander wrote:
> > select * FROM (select 1 as a) t2 left join t2 t3 ON TRUE
> > causes error
> > ERROR:  relation "t2" does not exist

> Not entirely sure if this is what you're looking for, but I think a
> CTE can solve your problem:
> WITH t2 AS (SELECT 1 AS a)
> SELECT * FROM t2 LEFT JOIN t3 ON TRUE

Shouldn't that be:
WITH t2 AS (SELECT 1 AS a)
SELECT * FROM t2 LEFT JOIN t2 t3 ON TRUE

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2010-01-04 12:48:59 Re: Migration of db
Previous Message Daniel Verite 2010-01-04 12:40:29 Re: set-level update fails with unique constraint violation