[MDEV-5351] ConnectSE: ODBC: MSSQL: A SELECT from a CATFUNC=Columns table returns an error Created: 2013-11-27  Updated: 2014-04-09  Resolved: 2014-04-09

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.10
Fix Version/s: 10.0.11

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Olivier Bertrand
Resolution: Not a Bug Votes: 0
Labels: connect-engine


 Description   

Run the following SQL script against an MS SQL Server data source:

mysql> drop table if exists t1;
Query OK, 0 rows affected (0.00 sec)
 
mysql> create table t1 engine=connect table_type=odbc connection='DSN=ms-amazon;UID=sa;PWD=mypw2013' catfunc=Columns;
Query OK, 0 rows affected (0.05 sec)
 
mysql> select * from t1;
ERROR 1296 (HY000): Got error 174 '[FreeTDS][SQL Server]Procedure or function 'sp_columns' expects parameter '@table_name', which was n' from CONNECT

The expected result (instead of this error) is to return rows with the information
about all columns of all tables existing in this data source .

Additionally, the error message is cut, which makes it confusing.
The entire error message is printed in the server error log:

[FreeTDS][SQL Server]Procedure or function 'sp_columns' expects parameter '@table_name', which was not supplied.
OpenTable: [FreeTDS][SQL Server]Procedure or function 'sp_columns' expects parameter '@table_name', which was not supplied.



 Comments   
Comment by Olivier Bertrand [ 2014-04-08 ]

To my knowledge, the MS SQL server is the only one that does not accept a columns query without table name.

Comment by Olivier Bertrand [ 2014-04-09 ]

The documentation will tell about this potential issue. It is perhaps possible to specify a table name of '%' to avoid the error but I cannot test it not having MS SQL Server installed on my machines.
Please let me know if it proves to be a fix.

Generated at Thu Feb 08 07:03:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.