Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nAwii-0000kY-Tu for pgsql-general@arkaria.postgresql.org; Fri, 21 Jan 2022 16:25:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nAwiC-0006aO-3V for pgsql-general@arkaria.postgresql.org; Fri, 21 Jan 2022 16:24:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nAwiB-0006aF-Jt for pgsql-general@lists.postgresql.org; Fri, 21 Jan 2022 16:24:27 +0000 Received: from mail1.bemta33.messagelabs.com ([67.219.247.4] helo=mail1.bemta33.sdw.messagelabs.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nAwi4-0002mo-Qi for pgsql-general@lists.postgresql.org; Fri, 21 Jan 2022 16:24:27 +0000 Received: from [100.114.68.254] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-4.bemta.az-a.us-east-2.aws.ess.symcld.net id 33/AB-00536-13EDAE16; Fri, 21 Jan 2022 16:24:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJsWRWlGSWpSXmKPExsWSoW9jqmt471W iweoTbBZn5h1idmD0ONpUGMAYxZqZl5RfkcCa8fnCTeaCdp2KKxunMjUwrlTrYuTiYBRYyiwx bdMW9i5GTiBnEatExyoWCDteYu/2Q+wgRSwCm5kleueuZwFxhATmM0mc69vIBuHcZ5T4/fEhW DubgLbE7Fk7wdpFBHwlPk+cAmYLC1hK7P94kA0ibicx99E6KFtPYvaUTrAaFgEniV2LF7JB2K oSf15+ZgKxeQViJf5dhbAZBcQkvp9aA2YzC4hL3HoyH8yWEBCQWLLnPDOELSrx8vE/1i5GDqD 6EolzLzkgwrISl+Z3M0LYvhK/d99hhbB1Jc5ePQAVz5E4uOYVC4StJnH101EoW05iVe9DKFte Ytqi9+wQtozEgxvbweEgIfCHVWLinNmMEE4ji8T07UugNhhIzPt2BKrqvYDE0409jBAf5Ekc3 XiIdQKj9iwkD81CkpoFDgBBiZMzn7BAxHUkFuz+xAZha0ssW/iaGcY+c+AxE7L4Akb2VYzWSU WZ6RkluYmZObqGBga6hoYmumbAdGJqoZdYpZuoV1qsm5pYXKJrpJdYXqyXWlysV1yZm5yTope XWrKJEZisUooc5+1gPLrqp94hRkkOJiVR3rxbrxKF+JLyUyozEosz4otKc1KLDzHKcHAoSfBu uwuUEyxKTU+tSMvMASZOmLQEB4+SCO+mO0Bp3uKCxNzizHSI1ClGV44JL+cuYubo6lkIJD+uW gIkv4PJSUd2b2cWYsnLz0uVEudVAZktANKcUZoHNxqW9C8xykoJ8zIyMDAI8RSkFuVmlqDKv2 IU52BUEuYtArmeJzOvBO6CV0DHMQEd53sb7LiSRISUVANTbk3Ov5r5j3W5v05aWLpM6sHhWpk r707sCbqiMqXhd26+ZPrd26d0FS62iVaxdoVdVbLPDFd0zJEL/eO6Myh96ZrOg6rFfBs0zt2I 9E6a/LXzr9pM1+56ZS9FFs25T+s6Ui3lWe9rPZBdmHm/ZEecQSr/3y3T8+WfaofbFczy+2ryb lKllrT7I4vK+0orv03wDNev/uc+f25wRQ6L/ZtCOcMqjqmz9VwOyN5JUb42uSuCY96hqotVv6 Piuk5XTHyy/uGd/oqb0YJpr7NY7q9QKzbs/2RpY2tW/GdR8a8FTZuYFZjL3/6Ufaf6Wa1xW1f 7jPhtq31f5DE+ZAn5wNX60XLyJf384+46Bq3BXUosxRmJhlrMRcWJAGu4ukZ1BAAA X-Env-Sender: alanolya@invera.com X-Msg-Ref: server-8.tower-704.messagelabs.com!1642782256!5541!1 X-Originating-IP: [104.47.60.53] X-SYMC-ESS-Client-Auth: mailfrom-relay-check=pass X-StarScan-Received: X-StarScan-Version: 9.81.7; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21599 invoked from network); 21 Jan 2022 16:24:17 -0000 Received: from mail-qb1can01lp2053.outbound.protection.outlook.com (HELO CAN01-QB1-obe.outbound.protection.outlook.com) (104.47.60.53) by server-8.tower-704.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 21 Jan 2022 16:24:17 -0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F23Akoh6vmwuhqU2O75xMMBivWFYFR3DkZTqPUzfMOL+WllTmKTlnzjusX4DHhRPxJaSQgFLW+x8YC9ETsybsFq5WcXmkXsW+tMTIs6SPIYZA/BTgDxJlzSh75ohJH6zsw7qF3IA3D42+MhxSafaizMGjMY5AFbNpuGEqQRKw6oyMGNTlDG6CsZ1uePGoXvaYtfHiQSLZLI0RNmJ4hFwVIBVw2kJ7RRJEYjD4DX8hDOG6i6TIJ30ncuvUicuGxlzVJGtg4puhzeZus6d+a6EbvDQARQt3fRnnwmGYgAGGJPrRnICmrOAFR08nSCQgmlNmM/VlxP7U+3Rw8gFLemlMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2a5L8qDwIOQdNIPUQCICAwDzXPYGrmhb5tlKNdiZAXk=; b=b3KcPH7fcC42vrvFzkO4CgXSHWAqtXVFkR3tTXXWzzhUVWUVa61V1PfJYt4dlBgmV5NsAweK2N5K0LtJykSaKVeTW83cSI2vegfDYggeRNzNMqHInIwDWB0pn92vptYv691kEb8M/IfOa1ylJcxGjWBz6FbweLi2gnSZh1eGoBmlgk7DXiXJ631dwYiUzKedahMm5yGbK93S6s6UgAzo3ZshcN45Cez4rRtqFVOSKviuEtkGxkGwtLJ1KM2INkJJWe3FFxZOKuvQqiG14e5dlNh7sR8ki5zNYB8nAif1PqhqM4XZ6CpPCEd3YcREHJxD6+e7a9ArbW+PzwD4HaRIug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invera365.onmicrosoft.com; s=selector2-invera365-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2a5L8qDwIOQdNIPUQCICAwDzXPYGrmhb5tlKNdiZAXk=; b=iXIrPpzuyzWwAGeE/Uhewm+CKZmejWExW4E7cqCyOWv0KT1QNdUZdW/Vg7RcqxklanA2rT8efP/Hq/1jewNvYcSPa2LvTWnWBdQPyiVqTz52x0FXpxAjtzLmgXWNfvdYSc/7qjxWZ9rPw3c6EM9xOVzmVlGbYTg8Rarfk4OD9QY= Received: from YQXPR01MB3000.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:4b::27) by YQXPR01MB2536.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:4e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Fri, 21 Jan 2022 16:24:14 +0000 Received: from YQXPR01MB3000.CANPRD01.PROD.OUTLOOK.COM ([fe80::8849:c95f:769e:3899]) by YQXPR01MB3000.CANPRD01.PROD.OUTLOOK.COM ([fe80::8849:c95f:769e:3899%7]) with mapi id 15.20.4909.011; Fri, 21 Jan 2022 16:24:14 +0000 From: Alanoly Andrews To: "pgsql-general@lists.postgresql.org" Subject: Using a different column name in a foreign table Thread-Topic: Using a different column name in a foreign table Thread-Index: AdgO4lwwtTLaW/dNQ1abEJMLotcBFg== Disposition-Notification-To: Alanoly Andrews Date: Fri, 21 Jan 2022 16:24:14 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 757b1a8d-4773-42d0-e57d-08d9dcfa76b2 x-ms-traffictypediagnostic: YQXPR01MB2536:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TQyDmeP88VlB5dsL5l7xP770gKyILQZpMMniKI4+Y05zX8IiqJZVrgQdU/c4MeqjNldNNU9NVWe60hQA/mXWJ5iiNNZQclnw6WXygCNFvzWeis4umVIhKoXt61FMj/hSc4Dmf/PuUS7dW0Sq+QXG5DkMv/IeoNSYHBSW7alVSJjkC0Z6D+fYk8yFr6XquRYCEkdzrI5Pqx46zpOkXTvMSfRSRU6BeIpktK/V5IZEJj7C81XBLFIx8ATL1g9esOzfXKrZEGcD4F30TVOx0EDWAT02iEqinlok4PP7nxKEe7KS5IFGE7EXCaSCJ2wToK+HnHgan7bS2kWpugB5E/OCtSTV/6o/O2FxU748jbOjGXeWUGDheTwKSq29ccfhs8YPzWYWjr/zzq701XmL09ybmfrcit5dsKD+nuc4NMhFxDnSIubEtH0KnCiuWPi0cH22xLoAPO3NyyS+QaAwgc1q3ERbzOWpTyYfplT8VGYHw5uMadnHT0lI9xeVGHSsLsxwN/vyyfO+p1WC+psE60v438AsQ55xQPUrq6E2aosNQayJ4FepXnJ9vPssApwBpqWkV7sdTpWsVpoPdVLWwo6eRnG1DADmChmUMpt1E1rOfGf6wesKSmSVMxUIL9fqoq/8f0BFJbJbe+XJLlkso/TF3T+VVH7jb5ZVvH54NqDMicfTLBuMDa+YTAvymHQKY5JCGwyuLRxtVqV6Tq1oYmN5pA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YQXPR01MB3000.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(136003)(366004)(376002)(39850400004)(346002)(396003)(9686003)(6916009)(122000001)(5660300002)(30864003)(186003)(52536014)(38100700002)(38070700005)(316002)(6506007)(83380400001)(71200400001)(26005)(66476007)(8676002)(33656002)(64756008)(66556008)(55016003)(8936002)(66446008)(2906002)(76116006)(66946007)(86362001)(966005)(508600001)(7696005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?uCwrYwb9oEqwvC+iyRznMlYijp3l47ZwamlxBj7IY5883v1AlhVcu9Kgglud?= =?us-ascii?Q?hwk+XXbEGNdtJb3stzDJW/HequMEEqbycpSDH+b5HWyu9Tvb2qdKLJP8d8/K?= =?us-ascii?Q?V/bJ/oU6SsqBAmHyYfdRC11CBDNAbhZqww17u6DH4esgKkVGtAV3KYhZq7to?= =?us-ascii?Q?SNro/nxf24luCzf94GPP8ORdOXXBE7BlrIrzI6LC0opAeeXPBns2SoJzkIrN?= =?us-ascii?Q?jhONwWMKV5bZfvA+mmQBjH97jZ/wZZqYYd3D32pTMckrtqGf9ooBLsQ7FY6J?= =?us-ascii?Q?IsU8WxAvCAuA+cELtOlZxWKd8RjfllfFYan4WV22nymEM6CJZMWVllCewLU0?= =?us-ascii?Q?l5XCId/fLYVUg5ZhQklX+XIOU1gh6Wj9Iu5OZk5M6LYtUs/pI7guXzngg8Oz?= =?us-ascii?Q?SWeO+yZeP1Q7pIkR8jxQm7aI87LcEdHXXxMHFRE9KrLzrvpgiDaqspasgqQ4?= =?us-ascii?Q?Z/xmRYQvKUQTXWeSQKFIA2cWqqbgeD0qEJU6eej8WJacAq/j7WUuuCvMOM30?= =?us-ascii?Q?F4uBff9Wt9oB57Y1/S8K/5+Na4sndrVl44MNrz59YcZxgRUzOA83aSNEz9Us?= =?us-ascii?Q?y9JGBI5LQD6JirmcccoZkZ7PqF2wYL+pxpw98B7JUMPHe+kO7LApLbr08W/b?= =?us-ascii?Q?mBgISD3aGL64AWQQJV1roYLUN9soT8378C++pcv7+Ub1kFNJplxvdw8oKGyL?= =?us-ascii?Q?LXN4AtT7LPNuHpJtEhhWhgbREZ4TZd+nONaHSMEaHLY3YzxTxwfVqJCJK4bD?= =?us-ascii?Q?R022QqOIE160+8q/QNuF1xLRlUxk+XL2XZEADVwah1AiWmx1jpf8AqLqjq0v?= =?us-ascii?Q?+676NgQJBaKIJWGd9u4XITP6S/aNLSZUJD7dly4h5N8e6qnfln1Vw0FJFCVS?= =?us-ascii?Q?15VJNOvqkGoph968VjoNBS38pziHPy5yS0DmsCK2hoyU+UEFaupD2IrM35Id?= =?us-ascii?Q?AQhFyxhH0rjy247IrmnLV5xOOOAOc5FL97qtBAQ+z7qOIk/mh5DKXXrr1pgt?= =?us-ascii?Q?avnCt2DMhK08in5PgHnKAZOSzM18mJzWPFVSc7BLgQFc5H9lEw9wyDihrAOq?= =?us-ascii?Q?mrKM64/dtS6WporEFa2vJQdaDN7vlrOEpLpn0MRSE5rdFLxQ/USyFrPFStNU?= =?us-ascii?Q?hl8qEWtHHhdQfHJ9CnPXl8syGqax81YsTiz3F56AqusAUqo6X7BaJckPU5PX?= =?us-ascii?Q?ahzOeiaecRTZsjEKvUBtSJoFSllIWpN+8iQEJY/ShR3OYHzlskScCqLFGkgA?= =?us-ascii?Q?JvejSPcWtUxyEFNUakXE+7PnkULWKc3ooNk4b8h3Y7f4KGpaC1RShY96S2KM?= =?us-ascii?Q?V8v7PJoM4uCJvbG/g56lYJJi4yC86Z3m0y4Bih06Gao7KchjAOFgyAg06eMM?= =?us-ascii?Q?P/JJBooOIpgz24fylF2qXfIqy+cXyc49LxD9zo/2j6Ysbxh7o7aJhMzk7Fia?= =?us-ascii?Q?RagEdAY9CoeGPrvOS/bwxjRdE0zBZStjjINhl4kU+5JaOrx+RcDJ1LsesGW4?= =?us-ascii?Q?x5GVpoIaVMyMlLk69cV7iix8v5pJaPaby7R7LxVri/kTofn2A7lIsuEWZ1wb?= =?us-ascii?Q?CRrqYuFhVL7sA63jG05JapJSNEv2qyAG7CpAEW+Jf54PwKc3QiEden3lPjPb?= =?us-ascii?Q?uyx/ZvV3XiXqzxRtpMnCZ6g=3D?= Content-Type: multipart/alternative; boundary="_000_YQXPR01MB3000CA608DF76835A6881B01AB5B9YQXPR01MB3000CANP_" MIME-Version: 1.0 X-OriginatorOrg: invera.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: YQXPR01MB3000.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 757b1a8d-4773-42d0-e57d-08d9dcfa76b2 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2022 16:24:14.0537 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 63c603f5-415e-4e47-92ce-37fe9a1a475d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: n4HY/hKbl2n2sH2d+FS3s2KCN6JhFLHuUeLNuaVYS1W4WpH0hP53al+3TL74lv6KU7IgMymrvRTp2kCcYCo2uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQXPR01MB2536 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_YQXPR01MB3000CA608DF76835A6881B01AB5B9YQXPR01MB3000CANP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 t= he FT. But when I query the FT, I get an error wrt to the column that had b= een 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'); 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. This e-mail may be privileged and/or confidential, and the sender does not = waive any related rights and obligations. Any distribution, use or copying = of this e-mail or the information it contains by other than an intended rec= ipient is unauthorized. If you received this e-mail in error, please advise= me (by return e-mail or otherwise) immediately. Ce courriel est confidentiel et prot?g?. L'exp?diteur ne renonce pas aux dr= oits et obligations qui s'y rapportent. Toute diffusion, utilisation ou cop= ie de ce message ou des renseignements qu'il contient par une personne autr= e que le (les) destinataire(s) d?sign?(s) est interdite. Si vous recevez ce= courriel par erreur, veuillez m'en aviser imm?diatement, par retour de cou= rriel ou par un autre moyen.'. If the disclaimer can't be applied, attach t= he message to a new disclaimer message. --_000_YQXPR01MB3000CA608DF76835A6881B01AB5B9YQXPR01MB3000CANP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hello,
 
I see that the syntax for the creation of a foreign table allows you t= o use a column name in the FT that is different from the one in the base ta= ble. Such a "create foreign table" statement executes successfull= y and creates the FT. But when I query the FT, I get an error wrt to the column that had been renamed. See example bel= ow:
&nbs= p;
create foreign table tab1_ft (
  id int,         =    
    name char(10) options(column_name 'newname'))
server xxxxxx
options(schema_name 'public', table_name 'tab1');
&nbs= p;
select * from tab1_ft;
 
ERROR:  column "newname" does not exist
HINT:  Perhaps you meant to reference the column "tab1.name&= quot;.
CONTEXT:  Remote SQL command: SELECT id, newname FROM public.tab1=
&nbs= p;
So, it seems that the when the remote SQL command is composed, the map= ping of 'newname' to the 'name' in the base table does not take effect.
Is there a resolution to this issue?
&nbs= p;
Awaiting some input.
 
Alanoly Andrews.
&nbs= p;

This e-mail may be privileged and/or confidential, an= d the sender does not waive any related rights and obligations. Any distrib= ution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthor= ized. If you received this e-mail in error, please advise me (by return e-m= ail or otherwise) immediately.

Ce courriel est confidentiel et protégé= . L'expéditeur ne renonce pas aux droits et obligations qui s'y rapp= ortent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) desti= nataire(s) désigné(s) est interdite. Si vous recevez ce courr= iel par erreur, veuillez m'en aviser immédiatement, par retour de co= urriel ou par un autre moyen.'. If the disclaimer can't be applied, attach the message to a new disclaimer message. --_000_YQXPR01MB3000CA608DF76835A6881B01AB5B9YQXPR01MB3000CANP_--