[MDEV-29012] Unexpected syntax error upon select from a Spider table, empty WHERE clause Created: 2022-07-02  Updated: 2023-07-20  Resolved: 2022-07-28

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nayuta Yanagisawa (Inactive)
Resolution: Duplicate Votes: 0
Labels: spider-gbh

Issue Links:
Blocks
is blocked by MDEV-29011 Server crash in spider_db_open_item_c... Closed
Duplicate
duplicates MDEV-29011 Server crash in spider_db_open_item_c... Closed

 Description   

--source plugin/spider/spider/include/init_spider.inc
 
SET spider_same_server_link= on;
eval create server s foreign data wrapper mysql options (host "127.0.0.1", database "test", user "root", port $MASTER_MYPORT);
 
CREATE TABLE t (a INT, b INT);
INSERT INTO t VALUES (1,2),(3,4);
CREATE TABLE t_spider (a INT, b INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't'";
 
SELECT * FROM t_spider WHERE a = 1 XOR b = 2;
 
# Cleanup
DROP TABLE t_spider, t;
 
--source plugin/spider/spider/include/deinit_spider.inc

10.4 392ee571

mysqltest: At line 10: query 'SELECT * FROM t_spider WHERE a = 1 XOR b = 2' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1

The reason is that the generated query to the underlying table contains an empty where clause:

select t0.`a` `a`,t0.`b` `b` from `test`.`t` t0 where ()

Reproducible on 10.4+.

On 10.3 the same test case causes a crash closely resembling MDEV-29011.



 Comments   
Comment by Nayuta Yanagisawa (Inactive) [ 2022-07-05 ]

I believe that the bug duplicates MDEV-29011. I will check this once MDEV-29011 has been fixed.

Comment by Nayuta Yanagisawa (Inactive) [ 2022-07-28 ]

The issue is a duplication of MDEV-29011.

Generated at Thu Feb 08 10:05:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.