Re: invalid reference to FROM-clause entry for table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: invalid reference to FROM-clause entry for table
Дата
Msg-id 472955.1727994092@sss.pgh.pa.us
обсуждение исходный текст
Ответ на invalid reference to FROM-clause entry for table  (Sam Stearns <sam.stearns@dat.com>)
Список pgsql-sql
Sam Stearns <sam.stearns@dat.com> writes:
> This one is really doing my head in:
>   ...
>   FROM (pud_fme_data d
>         inner join csbuser u on (u.userid=d.user_id)
>         inner join office o on (u.officeid=o.officeid)
>         left outer join login l on (l.userid=u.userid) ) alias6;

> ERROR:  invalid reference to FROM-clause entry for table "o"
> LINE 2:     o.crmaccountid AS crm_account_id,
>             ^
> DETAIL:  There is an entry for table "o", but it cannot be referenced from
> this part of the query.

IIRC, the join alias "alias6" hides any table aliases inside it.
Leave that off.  Or reference the column as "alias6.crmaccountid".
(This way might require fooling around with column aliases so that
crmaccountid is a unique column name within that scope.)

            regards, tom lane



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