[ODBC-248] Query using IN with 1000+ varbinary bound parameters ignores trailing whitespace Created: 2019-05-10  Updated: 2020-05-12  Resolved: 2020-05-12

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 2.0.14, 3.0.2, 3.1.1
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Peter Botha Assignee: Lawrin Novitsky
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Centos 7, Mariadb Server 10.3.15 and 10.3.12. Perl 5.16.3, perl-DBD-ODBC 1.50-3


Attachments: File trim_in_test.pl    

 Description   

When executing a query with 1000 or more bound parameters on a varbinary field such as:

SELECT c1 FROM table WHERE c1 IN (?,?....

Any record that happens to have a trailing space is not returned.
If you execute the query 999 bound parameters, all records are returned.

/etc/odbcinst.ini contains:

[MariaDB]
Description     = ODBC for MaridDB
Driver          = /usr/lib/libmaodbc.so
FileUsage       = 1

Attached is a perl script to reproduce the bug.

The perl test creates a table with a varbinary field, adds 999 records with every second one having a trailing space. Queries with 999 bound parameters, then repeats the query with 1000 bound parameters, of which the last one doesn't exist. It doesn't matter if I add another record and include it in the bound parameters, it's the fact that there are now 1000 that affects the results.

Output from perl script:

$ perl ./trim_in_test.pl -host=127.0.0.1 -driver={MariaDB} -user=test -passw
ord=password
Connecting to database
Creating table test_trim_in
Inserting 999 records
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Reading records
Records expected 999, Got 999
 
Reading records
Records expected 999, Got 499
Didn't get all rows from server (499) at ./trim_in_test.pl line 83.

The reason why I've logged this under ODBC is because the test script works with perl-DBD-MySQL



 Comments   
Comment by Lawrin Novitsky [ 2020-04-05 ]

Thank you for your report.

Interesting, I don' think that 1000 has any magical meaning in the C/ODBC.
I wonder what happens in case of 1000+ parameters and no trailing spaces? everything works fine as expected?

Comment by Peter Botha [ 2020-05-12 ]

Since time has moved on since reporting, I've tested again, and it appears as if this bug has been fixed in MariaDB Server 10.3.22

Comment by Lawrin Novitsky [ 2020-05-12 ]

Thanks, closing it then

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