You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by "Pavel Vinokurov (JIRA)" <ji...@apache.org> on 2018/02/22 08:26:04 UTC

[jira] [Created] (IGNITE-7785) SQL query with COUNT and UNION in sub-query produces JdbcSQLException

Pavel Vinokurov created IGNITE-7785:
---------------------------------------

             Summary: SQL query with COUNT and UNION in sub-query produces JdbcSQLException
                 Key: IGNITE-7785
                 URL: https://issues.apache.org/jira/browse/IGNITE-7785
             Project: Ignite
          Issue Type: Bug
          Components: sql
    Affects Versions: 2.3, 2.1
            Reporter: Pavel Vinokurov


SQL initial script:

CREATE TABLE Person(id INTEGER PRIMARY KEY, company_id INTEGER);
CREATE TABLE Company(id INTEGER PRIMARY KEY, name VARCHAR);
INSERT INTO Person(id,company_id) VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO Company(id,name) VALUES (1,'n1'), (2,'n2'), (3,'n3');

SQL Query:

SELECT count(*) FROM person p
LEFT JOIN (select id from company union select id from company) as c on c.id=p.company_id

SQL error:

Caused by: org.h2.jdbc.JdbcSQLException: Column "P__Z0.COMPANY_ID" must be in the GROUP BY list; SQL statement:
SELECT
P__Z0.COMPANY_ID __C0_0,
COUNT(*) __C0_1
FROM PUBLIC.PERSON P__Z0 [90016-195]

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)