[MDEV-8137] Surprising limit for varchar field for CONNECT database with ODBC Created: 2015-05-11  Updated: 2015-05-11  Resolved: 2015-05-11

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Connect
Affects Version/s: 10.0.17
Fix Version/s: 10.0.17

Type: Bug Priority: Major
Reporter: Artur Formella Assignee: Olivier Bertrand
Resolution: Not a Bug Votes: 0
Labels: ODBC, SQLITE
Environment:

Windows 8.1, x64


Attachments: File db.sqlite    

 Description   

Varchar size in the following case is limited to 203. I don't know how to extend it.
DDL:

drop table if exists `lite_test`;
create table lite_test (
`id` INT(10) UNSIGNED NOT NULL,
`name` varchar(203) NOT NULL
)
ENGINE=CONNECT READONLY=1 TABLE_TYPE=ODBC tabname='test'
CONNECTION='DSN=SQLite3 Datasource;Database=C:\\Download
db.sqlite'
CHARSET=utf8 DATA_CHARSET=utf8;

And now:

SELECT * FROM `lite_test` ORDER BY `name` ASC /* OK */

But:

ALTER TABLE `lite_test` CHANGE `name` `name` VARCHAR(205) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

SELECT * FROM `lite_test` ORDER BY `name` ASC

Throws an error:
" ERROR #1032 - Can't find record in 'lite_test'. "
But without ORDER BY clause works as expected.

ENV:

connect conv size 8,192
connect exact info OFF
connect indx map OFF
connect json grp size 10
connect timeout 10
connect type conv NO
connect use tempfile AUTO
connect work size 67,108,864
connect xtrace 0

SQLITE DDL:

DROP TABLE IF EXISTS "test";
CREATE TABLE "test" ("id" INTEGER, "name" TEXT);
INSERT INTO "test" VALUES(1,'test');
INSERT INTO "test" VALUES(2,'test2');
INSERT INTO "test" VALUES(3,'test3');



 Comments   
Comment by Olivier Bertrand [ 2015-05-11 ]

This not a bug but a limitation due to the fact that ODBC tables are not indexable. Look at the corresponding chapter of the documentation:

https://mariadb.com/kb/en/mariadb/connect-table-types-odbc-table-type-accessing-tables-from-other-dbms/#random-access-of-odbc-tables

In your case of a read only small table, the simpler way to make this work is to execute:

ALTER TABLE `lite_test` BLOCK_SIZE=3;

Why does it happen only when the varchar size is more than 203 is probably due to MariaDB that decides over this limit to use random access instead of sorting locally values obtained sequentially.

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