Re: getting column names

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: getting column names
Дата
Msg-id CAKFQuwbyqFJkXQe5gaFk-smgYiGZodv-ONj0_zMyF5PQvsntfg@mail.gmail.com
обсуждение исходный текст
Ответы Re: getting column names  ("Armand Pirvu (home)" <armand.pirvu@gmail.com>)
Список pgsql-general
On Tue, Apr 4, 2017 at 2:51 PM, Armand Pirvu (home) <armand.pirvu@gmail.com> wrote:

But if I join back to foo1 like below I get

select a.audit_id, a.table_name, b[1],b[2]
from
foo1 a,
(select
array(
select
column_name::text from
information_schema.columns
where
table_name=a.table_name
and
(
column_name like '%add_by%'
or
column_name like '%add_date%'
)) b) as foo
;

ERROR:  invalid reference to FROM-clause entry for table "a"
LINE 10: table_name=a.table_name
                    ^
HINT:  There is an entry for table "a", but it cannot be referenced from this part of the query.

​Adding LATERAL before the second "from_item" should get rid of the error - whether it results in a working and/or correct query I don't know.​

David J.

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

Предыдущее
От: "Armand Pirvu (home)"
Дата:
Сообщение: getting column names
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unexpected interval comparison