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

parse error when selecting on views using dynamic column

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.1, 5.5.29, 5.5.30, 5.3.12
    • 10.0.2, 5.5.31, 5.3.13
    • None
    • None

    Description

      The following query is fine :

      SELECT 
        R.splitlot_id,
        R.run_id, 
        I.ptest_info_id,
        COLUMN_GET(R.dynamic_flags,I.ptest_info_id as CHAR(1)),
        COLUMN_GET(R.dynamic_value,I.ptest_info_id as DECIMAL ) 
      FROM  
        wt_ptest_results_rows R INNER JOIN
        wt_ptest_info I on R.splitlot_id=I.splitlot_id
      where 
        COLUMN_GET(R.dynamic_value,I.ptest_info_id as DECIMAL) IS NOT NULL;

      but

      CREATE VIEW `wt_ptest_results_view`
      (splitlot_id,run_id,ptest_info_id,flags,value) AS 
      SELECT 
        R.splitlot_id,
        R.run_id, 
        I.ptest_info_id,
        COLUMN_GET(R.dynamic_flags,I.ptest_info_id as CHAR(1)),
        COLUMN_GET(R.dynamic_value,I.ptest_info_id as DECIMAL ) 
      FROM  
        wt_ptest_results_rows R INNER JOIN
        wt_ptest_info I on R.splitlot_id=I.splitlot_id
      where 
        COLUMN_GET(R.dynamic_value,I.ptest_info_id as DECIMAL) IS NOT NULL;
       
      select * from wt_ptest_results_view limit 1;
      ERROR 1064 (42000): 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 ') a
      s char(1) charset utf8) AS `flags`,cast(column_get(`r`.`dynamic_value`,`i`.`p' a
      t line 1
       
      show create view wt_ptest_results_view;
      ERROR 1064 (42000): 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 ') a
      s char(1) charset utf8) AS `flags`,cast(column_get(`r`.`dynamic_value`,`i`.`p' a
      t line 1

      Here is an simplified version of the tables in the test :

      CREATE TABLE `wt_ptest_info` (
        `splitlot_id` int(10) unsigned NOT NULL DEFAULT '0',
        `ptest_info_id` smallint(5) unsigned NOT NULL DEFAULT '0',
        KEY `wtptestinfo_splitlot_ptest` (`splitlot_id`,`ptest_info_id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=1
       
       
      CREATE TABLE `wt_ptest_results_rows` (
        `splitlot_id` int(10) unsigned NOT NULL DEFAULT '0',
        `run_id` mediumint(7) unsigned NOT NULL DEFAULT '0',
        `dynamic_flags` blob,
        `dynamic_value` blob,
        PRIMARY KEY (`splitlot_id`,`run_id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            stephane@skysql.com VAROQUI Stephane
            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.