Re: Visibility of table aliases in CTEs

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Visibility of table aliases in CTEs
Дата
Msg-id 1384616915126-5778692.post@n5.nabble.com
обсуждение исходный текст
Ответ на Visibility of table aliases in CTEs  (Raymond O'Donnell <rod@iol.ie>)
Ответы Re: Visibility of table aliases in CTEs  (Raymond O'Donnell <rod@iol.ie>)
Список pgsql-general
Raymond O'Donnell wrote
> Hello all,
>
> In a WITH query, are table aliases within a CTE isolated from the rest
> of the query? For example, if I do this -
>
>   with my_cte as (
>     select * from my_table t
>   )
>   ....
>
> - can I re-use the alias "t" elsewhere in the same query?
>
> I had a dig through the appropriate section of the docs, but the answer
> wasn't obvious to me there.

This seems like one of those "just try it and see what happens" kind of
question.  But since I'm mobile and cannot run SQL I'll just say that such
an alias is indeed hidden.  No different than:

Select * from (tbla as alpha natrual join tblb as beta) as ab natural join
tbla as alpha

David J.






--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Visibility-of-table-aliases-in-CTEs-tp5778687p5778692.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


В списке pgsql-general по дате отправления:

Предыдущее
От: Jayadevan
Дата:
Сообщение: Re: log_line_prefix
Следующее
От: Raymond O'Donnell
Дата:
Сообщение: Re: Visibility of table aliases in CTEs