Re: Alias field names in foreign data wrapper?

From: Deven Phillips <deven(dot)phillips(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Alias field names in foreign data wrapper?
Date: 2015-03-27 20:55:23
Message-ID: CAJw+4NCw1UDfO1yPQ_WmsUfGO4_4FDCeQ=VgEGRUQ7N04h0ekg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Better example of the problem... My FDW table schema is:

CREATE FOREIGN TABLE liquorstore_backendipaddress (
id bigint NOT NULL,
backend_network_id bigint,
backend_virtual_interface_id bigint,
address character varying(15) NOT NULL,
is_gateway boolean NOT NULL,
is_reserved boolean NOT NULL
)
SERVER edison
OPTIONS (
dbname 'edison',
table_name 'liquorstore_backendvirtualinterface'
);

But when I run the following query:

SELECT
*
FROM liquorstore_backendipaddress

I get an error:

ccedison=# SELECT * FROM liquorstore_backendipaddress;
ERROR: failed to prepare the MySQL query:
Unknown column 'backend_network_id' in 'field list'

I still cannot figure out what the problem might be so any help would be
GREATLY appreciated.

Thanks,

Deven

On Fri, Mar 27, 2015 at 4:15 PM, Deven Phillips <deven(dot)phillips(at)gmail(dot)com>
wrote:

> I am trying out some ideas using FDW, and I have added some FDW tables
> which access a backend MySQL DB... Unfortunately, I am getting some errors
> because of fields names with reserved words. I was wondering if there is a
> way to "alias" a field name when creating the foreign table?
>
> Thanks in advance!!!
>
> Deven
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2015-03-27 21:06:49 Re: Alias field names in foreign data wrapper?
Previous Message Deven Phillips 2015-03-27 20:16:38 Re: json-patch support?