Re: SELECT does not find table created by itself - Mailing list pgsql-general

From Magnus Hagander
Subject Re: SELECT does not find table created by itself
Date
Msg-id 9837222c1001040029l705427eeg84cefcde8656983b@mail.gmail.com
Whole thread Raw
In response to SELECT does not find table created by itself  ("Andrus" <kobruleht2@hot.ee>)
Responses Re: SELECT does not find table created by itself  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
List pgsql-general
2010/1/2 Andrus <kobruleht2@hot.ee>:
> select * FROM (select 1 as a) t2 left join t2 t3 ON TRUE
>
> causes error
>
> ERROR:  relation "t2" does not exist
>
> How to fix so that table t2 is created only once ?

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



--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Using autogenerated primary key in transaction
Next
From: "A. Kretschmer"
Date:
Subject: Re: Using autogenerated primary key in transaction