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

CONNECT PIVOT generates nonsense SQL

    XMLWordPrintable

Details

    Description

      The CONNECT engine is generating nonsense SQL for a PIVOT table I created:

      drop table if exists t1;
      CREATE TABLE `t1` (  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,  `name` varchar(32) DEFAULT NULL,  `cnt` int(11) DEFAULT NULL,  PRIMARY KEY (`id`) ) ENGINE=InnoDB;
      INSERT INTO `t1` VALUES (1,'apple',1),(2,'banana',1),(3,'apple',2),(4,'cherry',4),(5,'durazno',2);
      drop table if exists fruit_pivot;
      CREATE TABLE fruit_pivot ENGINE=CONNECT TABLE_TYPE=pivot TABNAME=t1;
      select * from fruit_pivot;

      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 'id, nameSELECT , SUM(cnt) cnt FROM t1 GROUP BY' at line ' from CONNECT

      From the general query log:

                         10 Query     SELECT id, nameSELECT , SUM(cnt) cnt FROM t1 GROUP BY id, nameSELECT id, nameSELECT , SUM(cnt) cnt FROM t1 GROUP BY

      Attachments

        Activity

          People

            bertrandop Olivier Bertrand
            kolbe Kolbe Kegel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.