aws / amazon-redshift-odbc-driver

Apache License 2.0
18 stars 7 forks source link

Requested conversion is not supported #23

Open alainbryden opened 1 month ago

alainbryden commented 1 month ago

Version

Problem description

Upon upgrading from 1.x to 2.x driver versions, most of our queries now return the following error:

OLE DB provider "MSDASQL" for linked server "REDSHIFT" returned message "Requested conversion is not supported.".

This happens for pretty any OPENQUERY([REDSHIFT], 'SELECT * FROM sometable') which ends up containing a "TEXT" column in it somewhere.

This never happened on the 1.x version, presumably due to there being "Data Type Options" on the old version for specifying the maximum data length of LongVarChar columns: image


Many other ODBC drivers have a history of producing similar errors. This reportedly comes from converting various types to MaxLongVarChar, but creating nvarchars larger than 8000 (which SQL Server does not support). All of these drivers have in time come to support a "Max LongVarChar" setting, or similar, which automatically fixes this issue, without users needing to manually wrap all columns in CAST(column AS NVARCHAR(8000)) in all of their queries.

Here are some examples I've seen in the wild: From Pythian: image

From Snowflake:

Please configure the workaround parameter on the remote MSSQL server's ODBC driver installation, rather than the local one (where SSMS is installed): Open Regedit as an Administrator (on the MSSQL host), navigate to HKEY_LOCAL_MACHINE > Software > ODBC > ODBC.INI > Create a new String key 'default_varchar_size' and with value 4000

From Simba: image


Can we add back something similar here, or are the old options still available as a registry or connection string setting?

vahid110 commented 1 month ago

Hi @alainbryden Thank you for taking the time to report this issue. I appreciate your effort and will make sure it reaches the appropriate team for investigation as soon as possible.