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

CONNECT engine does not quote columns involved in WHERE clause

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.7.3, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL)
    • 10.3.37, 10.4.27, 10.5.18, 10.6.11, 10.7.7, 10.8.6
    • 10.7.3-MariaDB-1:10.7.3+maria~focal-log from docker image for both source and CONNECT servers. `dpkg -s mariadb-plugin-connect | grep Version` reports `Version: 1:10.7.3+maria~focal` for connect plugin

    Description

      Hello,

      I have noticed that the connect engine does not properly quote columns in WHERE when the table type is MySQL. For example, issuing the following query against a CONNECT database:

      SELECT `ID` FROM t1 WHERE t1.`spaced col` = 'C-003';
      

      will issue the following against the main server:

      SELECT `ID`, `spaced col` FROM `t1` WHERE spaced col= 'C-003';
      

      Note how the WHERE clause is unquoted, which raises a syntax error.

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa added a comment -

            Thank you for the report!

            let $port= select @@port;
             
            CREATE TABLE t1 (id int, `spaced col` varchar(10));
            insert into t1 values (1,1),(2,'C-003');
             
            CREATE TABLE t2 (id int, `spaced col` varchar(10))
            engine=connect table_type=mysql option_list='host=localhost,user=root,port=3313' dbname='test' tabname='t1';
             
            SELECT `id` FROM t2 WHERE t2.`spaced col` = 'C-003';
            

            MariaDB [test]> SELECT `id` FROM t2 WHERE `spaced col` = 'C-003';
            ERROR 1296 (HY000): Got error 174 '(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 'col= 'C-003'' at line 1 [SELECT `id`, `spaced col` FROM ' from CONNECT
            

            alice Alice Sherepa added a comment - Thank you for the report! let $port= select @@port; CREATE TABLE t1 (id int , `spaced col` varchar (10)); insert into t1 values (1,1),(2, 'C-003' ); CREATE TABLE t2 (id int , `spaced col` varchar (10)) engine= connect table_type=mysql option_list= 'host=localhost,user=root,port=3313' dbname= 'test' tabname= 't1' ; SELECT `id` FROM t2 WHERE t2.`spaced col` = 'C-003' ; MariaDB [test]> SELECT `id` FROM t2 WHERE `spaced col` = 'C-003'; ERROR 1296 (HY000): Got error 174 '(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 'col= 'C-003'' at line 1 [SELECT `id`, `spaced col` FROM ' from CONNECT

            People

              anel Anel Husakovic
              tgross35 Trevor Gross
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.