Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-29012

Unexpected syntax error upon select from a Spider table, empty WHERE clause

    XMLWordPrintable

Details

    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.

      Attachments

        Issue Links

          Activity

            People

              nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.