Windows ODBC Driver configuration help

Andrew Kagan <[email protected]> Thu, 14 Nov 2019 23:03:30 +0000
Newsgroups gmane.comp.db.postgresql.odbc
Message-ID <MN2PR13MB359989E039A2C7BEBC3EE96BB6710@MN2PR13MB3599.namprd13.prod.outlook.com>
--_000_MN2PR13MB359989E039A2C7BEBC3EE96BB6710MN2PR13MB3599namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

[Redirecting from pgsql-novice]

Hi All: First time poster and PostgreSQL noob...trying to set up a linked s=
erver in SSMS (SQL Server 15.0.2000.5) using 64-bit PostgreSQL Unicode(x64)=
 driver. The PostgreSQL server is 10.5. My access to the server is readonly=
.

I configured the datasource and tested successfully, and am able to create =
the linked server in SSMS and drill down to the tables, but if I try a simp=
le query, I receive the error:

Msg 7356, Level 16, State 1, Line 2
The OLE DB provider "MSDASQL" for linked server "[DSNname]" supplied incons=
istent metadata for a column. The column "[colname]" (compile-time ordinal =
3) of object ""[table]"."public"."[column]"" was reported to have a "DBCOLU=
MNFLAGS_ISLONG" of 128 at compile time and 0 at run time.

In pgAdmin, the datatype of the column referenced in the error is "citext".=
 The field is limited to 5 characters by the app connected to the dB, so th=
ere isn't any really long text in it.

On the driver config first page, I have "text as LongVarChar" checked and t=
he other two boxes unchecked. I have "unknown sizes" set to "maximum".

I tried casting the field in the error message as "nvarchar(512)" but it di=
dn't help.

Not sure if it's a setting in the ODBC driver, but the few citations on Goo=
gle pointed to that being the source of the error (and the settings I'm usi=
ng above is supposed to fix it).

TIA!


--_000_MN2PR13MB359989E039A2C7BEBC3EE96BB6710MN2PR13MB3599namp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">[Redirecting from pgsql-novice]<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Hi All: First time poster and PostgreSQL noob&#8230;=
trying to set up a linked server in SSMS (SQL Server 15.0.2000.5) using 64-=
bit PostgreSQL Unicode(x64) driver. The PostgreSQL server is 10.5. My acces=
s to the server is readonly.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I configured the datasource and tested successfully,=
 and am able to create the linked server in SSMS and drill down to the tabl=
es, but if I try a simple query, I receive the error:<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Msg 7356, Level 16, State 1, Line 2<o:p></o:p></p>
<p class=3D"MsoNormal">The OLE DB provider &quot;MSDASQL&quot; for linked s=
erver &quot;[DSNname]&quot; supplied inconsistent metadata for a column. Th=
e column &quot;[colname]&quot; (compile-time ordinal 3) of object &quot;&qu=
ot;[table]&quot;.&quot;public&quot;.&quot;[column]&quot;&quot; was reported=
 to have a &quot;DBCOLUMNFLAGS_ISLONG&quot;
 of 128 at compile time and 0 at run time.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">In pgAdmin, the datatype of the column referenced in=
 the error is &quot;citext&quot;. The field is limited to 5 characters by t=
he app connected to the dB, so there isn&#8217;t any really long text in it=
.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">On the driver config first page, I have &#8220;text =
as LongVarChar&#8221; checked and the other two boxes unchecked. I have &#8=
220;unknown sizes&#8221; set to &#8220;maximum&#8221;.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I tried casting the field in the error message as &#=
8220;nvarchar(512)&#8221; but it didn&#8217;t help.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Not sure if it&#8217;s a setting in the ODBC driver,=
 but the few citations on Google pointed to that being the source of the er=
ror (and the settings I&#8217;m using above is supposed to fix it).<o:p></o=
:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">TIA!<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_MN2PR13MB359989E039A2C7BEBC3EE96BB6710MN2PR13MB3599namp_--