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 1pFWcP-00046H-8g for pgsql-admin@arkaria.postgresql.org; Wed, 11 Jan 2023 08:37:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFWcN-0006nd-Sk for pgsql-admin@arkaria.postgresql.org; Wed, 11 Jan 2023 08:37:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFWcN-0006nP-DC for pgsql-admin@lists.postgresql.org; Wed, 11 Jan 2023 08:37:55 +0000 Received: from jakobs.com ([85.214.83.89] helo=rs.plausibolo.de) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFWcK-00021h-4l for pgsql-admin@lists.postgresql.org; Wed, 11 Jan 2023 08:37:54 +0000 Received: from localhost (localhost [127.0.0.1]) by rs.plausibolo.de (Postfix) with ESMTP id E4A393804F8; Wed, 11 Jan 2023 09:37:49 +0100 (CET) Received: from rs.plausibolo.de ([127.0.0.1]) by localhost (h2367442.stratoserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aE9u2q-D71Po; Wed, 11 Jan 2023 09:37:49 +0100 (CET) Received: from [192.168.178.28] (ip-037-201-152-231.um10.pools.vodafone-ip.de [37.201.152.231]) by rs.plausibolo.de (Postfix) with ESMTPSA id 823453802F5; Wed, 11 Jan 2023 09:37:49 +0100 (CET) Message-ID: <82da1091-ef02-ed31-06ea-158eaaaf1ed2@jakobs.com> Date: Wed, 11 Jan 2023 09:37:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Select on Foreign table is not working To: pgsql-admin@lists.postgresql.org References: From: Holger Jakobs In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------wvXBRRNAFia0fcxq0G6zpnoA" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------wvXBRRNAFia0fcxq0G6zpnoA Content-Type: multipart/mixed; boundary="------------ZnBC7mlzvlD0g0ELNBjWrZQ8"; protected-headers="v1" From: Holger Jakobs To: pgsql-admin@lists.postgresql.org Message-ID: <82da1091-ef02-ed31-06ea-158eaaaf1ed2@jakobs.com> Subject: Re: Select on Foreign table is not working References: In-Reply-To: --------------ZnBC7mlzvlD0g0ELNBjWrZQ8 Content-Type: multipart/alternative; boundary="------------DFUin9PdPUrnUfW5NJPXNjAf" --------------DFUin9PdPUrnUfW5NJPXNjAf Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 QW0gMTEuMDEuMjMgdW0gMDk6MTIgc2NocmllYiBTYWhpbCBLaGFuOg0KPiBIaSwNCj4NCj4g SG9wZcKgeW91IGFyZSBkb2luZyB3ZWxsLA0KPg0KPiBJIGhhdmUgY3JlYXRlZCBhIGZvcmVp Z24gdGFibGUgb24gbXkgcG9zdGdyZXNxbCBzZXJ2ZXIgdG8gc2VsZWN0IHRoZSANCj4gZGF0 YSBvbiBleHRlcm5hbCB0YWJsZSB3aGljaCBpcyByZXNpZGUgb24gTVMgU1FMIFNlcnZlciwg ZXZlcnl0aGluZyANCj4gd2VudCB3ZWxsIGZyb20gaW5zdGFsbGluZyB0byBmcmVldGRzIGFu ZCBpbnN0YWxsaW5nIGFuZCBjb25maWd1cmluZyANCj4gdGRzX2ZkdyB0b29sLCBhbmQgY3Jl YXRlZCBmb3JlaWduIHNlcnZlciBhbmQgdXNlciBtYXBwaW5nIHRoZW4gY3JlYXRlZCANCj4g Zm9yZWlnbiB0YWJsZSwgYnV0IHdoZW4gaSBkbyBzZWxlY3QgZnJvbSB0YWJsZV9uYW1lIHRo ZW4gaXQgdGhyb3dzIGFuIA0KPiBlcnJvciB3aGljaCBpcyBpIG1lbnRpb25lZCBiZWxvdyBh cy4NCj4NCj4gRVJST1I6IMKgREItTGlicmFyeSBlcnJvcjogREIgIzogMjAwMTgsIERCIE1z ZzogR2VuZXJhbCBTUUwgU2VydmVyIA0KPiBlcnJvcjogQ2hlY2sgbWVzc2FnZXMgZnJvbSB0 aGUgU1FMIFNlcnZlciwgT1MgIzogLTEsIE9TIE1zZzogLCBMZXZlbDogMTYNCj4NCj4NCj4g d2lsbCBiZSBoaWdobHkgZ3JhdGVmdWzCoGZvciB5b3VywqB2YWx1YWJsZSBzdWdnZXN0aW9u cywgd2hlcmUgdG8gbG9vayANCj4gZm9yIHRvIGdldCB0aGlzIGRvbmUuDQo+DQo+IFRoYW5r IFlvdS4NCj4NCj4gUmVnYXJkcywNCj4gU2FoaWwgfCArOTE5ODkyNTY5NjEwDQoNCkkgd291 bGQgc3VnZ2VzdCB0byBkbyBhcyB0aGUgbWVzc2FnZSBzYXlzOg0KDQoqQ2hlY2sgbWVzc2Fn ZXMgZnJvbSB0aGUgU1FMIFNlcnZlcioNCg0KU28sIHRoZSBsb2cgb24gdGhlIGZvcmVpZ24g c2VydmVyIHNob3VsZCBoYXZlIG1vcmUgaW5mb3JtYXRpb24sIHdoaWNoIA0KaXNuJ3QgZm9y d2FyZGVkIHRvIFBvc3RncmVTUUw6DQoNCktpbmQgUmVnYXJkcywNCkhvbGdlcg0KDQotLSAN CkhvbGdlciBKYWtvYnMsIEJlcmdpc2NoIEdsYWRiYWNoLCBUZWwuICs0OS0xNzgtOTc1OTAx Mg0KDQo= --------------DFUin9PdPUrnUfW5NJPXNjAf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Am 11.01.23 um 09:12 schrieb Sahil Khan:
Hi,

Hope=C2=A0you are doin= g well,

I have created a foreign table on my postgresql server to select the data on external table which is reside on MS SQL Server, everything went well from installing to freetds and installing and configuring tds_fdw tool, and created foreign server and user mapping then created foreign table, but when i do select from table_name then it throws an error which is i mentioned below as.

ERROR: =C2=A0DB-Librar= y error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 16
=


will be highly grateful=C2=A0for your=C2=A0valuable suggestions, where to look= for to get this done.

Thank You.

Regards,
Sahil | +919892569610

I would suggest to do as the message says:

=C2=A0=C2=A0=C2=A0 Ch= eck messages from the SQL Server

So, the log on the foreign server should have more information, which isn't forwarded to PostgreSQL:

Kind Regards,
Holger

--=20
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
--------------DFUin9PdPUrnUfW5NJPXNjAf-- --------------ZnBC7mlzvlD0g0ELNBjWrZQ8-- --------------wvXBRRNAFia0fcxq0G6zpnoA Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wmMEABEIACMWIQScuJCxWJK1p5BOebGKV5yTsxlhugUCY751XAUDAAAAAAAKCRCKV5yTsxlhuo5k AJ9DlMjwgWfyYYf/EhCFTe5U0+RHsgCfXGRFSJxpmXRyn4VBExuTDkvaW/M= =qE3C -----END PGP SIGNATURE----- --------------wvXBRRNAFia0fcxq0G6zpnoA--