Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.1(EOL)
-
None
Description
I create a table on the remote 10.0.21-MariaDB server:
CREATE OR REPLACE TABLE t1 (a INT);
|
INSERT INTO t1 VALUES (10),(20),(30);
|
Now connect the remote table to a local 10.1.10-MariaDB-debug server:
CREATE OR REPLACE TABLE t1 (a int) ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='dsn=MySQL;uid=root';
|
SELECT * FROM t1;
|
This seems to work fine.
Now I additionally use automatic table structure discovery:
CREATE OR REPLACE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='dsn=MySQL;uid=root';
|
It crashes with this stack trace:
#0 0x0000000000000000 in ?? ()
|
#1 0x00007fff896b35bb in mysql_list_fields ()
|
from /usr/lib64/mysql/libmysqlclient.so.18
|
#2 0x00007fffa8dba72c in server_list_dbcolumns ()
|
from /usr/lib64/libmyodbc5.so
|
#3 0x00007fffa8dbad46 in columns_no_i_s () from /usr/lib64/libmyodbc5.so
|
#4 0x00007fffa8dd9465 in SQLColumnsW () from /usr/lib64/libmyodbc5.so
|
#5 0x00007fffb259e4a3 in SQLColumns () from /lib64/libodbc.so.2
|
#6 0x00007ffff35afd13 in ODBConn::GetCatInfo (this=0x7fff89c00048,
|
cap=0x7fff89cf9d08)
|
at /home/bar/maria-git/server.10.1/storage/connect/odbconn.cpp:2261
|
#7 0x00007ffff35ab9bd in ODBCColumns (g=0x7fff8e833000,
|
dsn=0x7fff89c00008 "dsn=MySQL;uid=root", db=0x0,
|
table=0x7fff8e8251b0 "t1", colpat=0x0, maxres=4096, info=false,
|
sop=0x7fff89c00020)
|
at /home/bar/maria-git/server.10.1/storage/connect/odbconn.cpp:380
|
#8 0x00007ffff34f3187 in connect_assisted_discovery (thd=0x7fff9fa29070,
|
table_s=0x7ffff7f7dc30, create_info=0x7ffff7f7e8c0)
|
...
|
│2256 // (SQLPOINTER)true, 0); │
|
│2257 fnc = "SQLColumns"; │
|
│2258 rc = SQLColumns(hstmt, name.ptr(2), name.length(2), │
|
│2259 name.ptr(1), name.length(1), │
|
│2260 name.ptr(0), name.length(0), │
|
>│2261 cap->Pat, SQL_NTS);
|
cap->Pat is NULL here, which looks wrong in combination with SQL_NTS.
It should be either NULL + 0, or an empty string "" + SQL_NTS.
But changing the code like this did not really help:
index 1ccdf23..b196d3f 100644
|
--- a/storage/connect/odbconn.cpp
|
+++ b/storage/connect/odbconn.cpp
|
@@ -2258,7 +2258,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
|
rc = SQLColumns(hstmt, name.ptr(2), name.length(2),
|
name.ptr(1), name.length(1),
|
name.ptr(0), name.length(0),
|
- cap->Pat, SQL_NTS);
|
+ cap->Pat, cap->Pat ? SQL_NTS : 0);
|
break;
|
case CAT_KEY:
|
fnc = "SQLPrimaryKeys";
|
Neither helped this:
--- a/storage/connect/odbconn.cpp
|
+++ b/storage/connect/odbconn.cpp
|
@@ -2258,7 +2258,8 @@ int ODBConn::GetCatInfo(CATPARM *cap)
|
rc = SQLColumns(hstmt, name.ptr(2), name.length(2),
|
name.ptr(1), name.length(1),
|
name.ptr(0), name.length(0),
|
- cap->Pat, SQL_NTS);
|
+ cap->Pat ? cap->Pat : (unsigned char*) "",
|
+ cap->Pat ? SQL_NTS : 0);
|
break;
|
case CAT_KEY:
|
fnc = "SQLPrimaryKeys";
|
So the reason must be somewhere else.
Attachments
Issue Links
- relates to
-
MDEV-9380 MariaDB server crashes with CONNECT engine ODBC and MySQL driver
-
- Open
-
Alexander, which connector are you using?
Using the MySQL ODBC connector version 5.3 I cannot reproduce the crash on Windows 7.
BTW your fix cap->Pat, cap->Pat ? SQL_NTS : 0); seems correct but the actual code has been used for many years and apparently did not cause any problem yet.