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

Unexpected ER_BAD_FIELD_ERROR upon SELECT DEFAULT from Spider table

    XMLWordPrintable

Details

    Description

      INSTALL SONAME 'ha_spider';
       
      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 (id INT DEFAULT 0) ENGINE=MyISAM;
      CREATE TABLE t_spider ENGINE=SPIDER COMMENT = 'srv "s", table "t"';
      SELECT DEFAULT(id) FROM t_spider;
       
      DROP TABLE t_spider, t;
       
      # Spider cleanup should be here
      

      12.3 3adf432a9fc68f428e9c8b38129c3b51f78b187f

      mysqltest: At line 8: query 'SELECT DEFAULT(id) FROM t_spider' failed: ER_BAD_FIELD_ERROR (1054): Unknown column 'test.t_spider.id' in 'SELECT'
      

      The query Spider generates for the remote server is

      select default(`test`.`t_spider`.`id`) `DEFAULT(id)` from `test`.`t` t0
      

      That is, it gets the fully-qualified name of the Spider table column, but the query is run on the remote table, so naturally it causes the error.

      Attachments

        Activity

          People

            ycp Yuchen Pei
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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