-
Notifications
You must be signed in to change notification settings - Fork 22
Description
I am getting an error running the test suite on a macbook with the M1 chip.
Specifically, the Database.ODBC.Internal, Data retrieval, Basic santiy check test fails with
UnsuccessfulReturnCode "getSize" (-1) "[unixODBC][Driver Manager]Program type out of range[unixODBC][Driver Manager]Program type out of range"
Context
I'm on macOS, M1 chip, using brew install HOMEBREW_NO_ENV_FILTERING=1 ACCEPT_EULA=Y brew install msodbcsql17 mssql-tools unixodbc to install odbc drivers.
I'm using the mcr.microsoft.com/azure-sql-edge:latest docker image to run mssql server:
$ docker run --name odbc-test-21433 --platform linux/arm64 -e ACCEPT_EULA=1 -e MSSQL_SA_PASSWORD=hUntEr202 -p 127.0.0.1:21433:1433 -d mcr.microsoft.com/azure-sql-edge
1> select @@VERSION;
2> go
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft Azure SQL Edge Developer (RTM) - 15.0.2000.1559 (ARM64)
Jun 8 2021 15:48:33
Copyright (C) 2019 Microsoft Corporation
Linux (Ubuntu 18.04.5 LTS aarch64) <ARM64>
but this issue also occurs when running SQL Server on a remote machine with x86_64:
> select @@VERSION;
[row 0]
: "Microsoft SQL Server 2019 (RTM-CU10) (KB5001090) - 15.0.4123.1 (X64) \n\tMar 22 2021 18:10:24 \n\tCopyright (C) 2019 Microsoft Corporation\n\tDeveloper Edition (64-bit) on Linux (Ubuntu 20.04.2 LTS) <X64>"
I've cloned the fpco/odbc repo and built with cabal and ghc-8.10.7, then ran the tests:
ODBC_TEST_CONNECTION_STRING='DRIVER={ODBC Driver 17 for SQL Server};SERVER=127.0.0.1,21433;Uid=sa;Pwd=hUntEr202;Encrypt=no' cabal v2-run tests
Result: 97 examples, 1 failure:
Failures:
test/Main.hs:198:3:
1) Database.ODBC.Internal, Data retrieval, Basic santiy check
uncaught exception: ODBCException
UnsuccessfulReturnCode "getSize" (-1) "[unixODBC][Driver Manager]Program type out of range[unixODBC][Driver Manager]Program type out of range"
I've tried to run this test repeatedly by changing the failing test in tests/Main.hs from:
it "Basic santiy check"to:
forM_ [1..100] $ \i -> describe "Basic sanity check" $ it (show (i :: Int))And ran it again:
ODBC_TEST_CONNECTION_STRING='DRIVER={ODBC Driver 17 for SQL Server};SERVER=127.0.0.1,21433;Uid=sa;Pwd=hUntEr202;Encrypt=no' cabal v2-run tests -- --match "Basic sanity"
And the failing test failed exactly 21 times and then started passing. This behaviour is consistent when running the test many times:
100 examples, 21 failures
I can replicate similar behaviour when running cabal v2-run odbc and running the test manually. If we are a bit persistent we can get the expected results:
% cabal v2-run odbc -- 'DRIVER={ODBC Driver 17 for SQL Server};SERVER=127.0.0.1,21433;Uid=sa;Pwd=hUntEr202;Encrypt=no'
> DROP TABLE IF EXISTS test;
Rows: 0
> CREATE TABLE test (int integer, text text, bool bit, nt ntext, fl float);
Rows: 0
> INSERT INTO test VALUES (123, 'abc', 1, 'wib', 2.415), (456, 'def', 0, 'wibble',0.9999999999999), (NULL, NULL, NULL, NULL, NULL);
Rows: 0
> SELECT * FROM test;
UnsuccessfulReturnCode "getSize" (-1) "[unixODBC][Driver Manager]Program type out of range[unixODBC][Driver Manager]Program type out of range["
> SELECT * FROM test;
UnsuccessfulReturnCode "getSize" (-1) "[unixODBC][Driver Manager]Program type out of range[unixODBC][Driver Manager]Program type out of range"
> SELECT * FROM test;
[row 0]
int: 123
text: "abc"
bool: True
nt: "wib"
fl: 2.415
[row 1]
int: 456
text: "def"
bool: False
nt: "wibble"
fl: 0.9999999999999
[row 2]
int: NULL
text: NULL
bool: NULL
nt: NULL
fl: NULL
Rows: 3