Re: Using a different column name in a foreign table

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Using a different column name in a foreign table
Дата
Msg-id e50df4be-e952-886f-8f48-472314708d51@aklaver.com
обсуждение исходный текст
Ответ на Using a different column name in a foreign table  (Alanoly Andrews <alanolya@invera.com>)
Список pgsql-general
On 1/21/22 08:24, Alanoly Andrews wrote:
> Hello,
> I see that the syntax for the creation of a foreign table allows you to 
> use a column name in the FT that is different from the one in the base 
> table. Such a "create foreign table" statement executes successfully and 
> creates the FT. But when I query the FT, I get an error wrt to the 
> column that had been renamed. See example below:
> create foreign table tab1_ft (
>    id int,
>      name char(10) options(column_name 'newname'))
> server xxxxxx
> options(schema_name 'public', table_name 'tab1');

What is the definition of the table tab1?

> select * from tab1_ft;
> ERROR:  column "newname" does not exist
> HINT:  Perhaps you meant to reference the column "tab1.name".
> CONTEXT:  Remote SQL command: SELECT id, newname FROM public.tab1
> So, it seems that the when the remote SQL command is composed, the 
> mapping of 'newname' to the 'name' in the base table does not take effect.
> Is there a resolution to this issue?
> Awaiting some input.
> Alanoly Andrews.
> 



-- 
Adrian Klaver
adrian.klaver@aklaver.com



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

Предыдущее
От: Shaozhong SHI
Дата:
Сообщение: Re: Query on postgres_fdw extension
Следующее
От: Dominique Devienne
Дата:
Сообщение: Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?