Skip to content

Commit 6689097

Browse files
committed
- Fix crash when sorting a TBL table with thread=yes.
This was because Tablist can be NULL when no lacal tables are in the list. modified: storage/connect/tabtbl.cpp modified: storage/connect/mysql-test/connect/r/tbl.result modified: storage/connect/mysql-test/connect/t/tbl.test
1 parent fb9e2fa commit 6689097

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

storage/connect/mysql-test/connect/r/tbl.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ SELECT * FROM t2;
153153
v
154154
22
155155
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
156-
SELECT * FROM total;
156+
SELECT * FROM total order by v desc;
157157
v
158158
22
159159
11

storage/connect/mysql-test/connect/t/tbl.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ SELECT * FROM t2;
6363

6464
--replace_result $PORT PORT
6565
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
66-
SELECT * FROM total;
66+
SELECT * FROM total order by v desc;
6767

6868
DROP TABLE total;
6969
DROP TABLE t1;

storage/connect/tabtbl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void)
607607
for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext())
608608
((PTDBASE)tabp->GetTo_Tdb())->ResetDB();
609609

610-
Tdbp = (PTDBASE)Tablist->GetTo_Tdb();
610+
Tdbp = (Tablist) ? (PTDBASE)Tablist->GetTo_Tdb() : NULL;
611611
Crp = 0;
612612
} // end of ResetDB
613613

@@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g)
679679
/* Table already open, replace it at its beginning. */
680680
/*******************************************************************/
681681
ResetDB();
682-
return Tdbp->OpenDB(g); // Re-open fist table
682+
return (Tdbp) ? Tdbp->OpenDB(g) : false; // Re-open fist table
683683
} // endif use
684684

685685
#if 0

0 commit comments

Comments
 (0)