sqsh 给出 "dsp_desc_bind: Memory allocation failure for column #1"

sqsh gives "dsp_desc_bind: Memory allocation failure for column #1"

在 Ubuntu 18.04 上使用 freetds 1.00.82-2 和 sqsh 2.1.7-4build1,我在尝试 SELECT foo FROM bar 时得到以下信息,其中 foo 是一个 nvarchar 列:

dsp_desc_bind: Memory allocation failure for column #1

为什么会这样?我看到一些古老的 bug reports,但我在那里看不到任何解决方案;此错误消息非常难以搜索。

我尝试将 freetds 降级到 0.91.6,这是我在 Ubuntu 17.10 上工作的,然后得到了更容易理解的错误消息

Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.

这让我找到了解决方案:

编辑 /etc/freetds/freetds.conf 并添加一个部分

[YourDbHostname]
      host = localhost
      port = 1433
      tds version = 8.0

现在可以了:)