You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Vinokurov (JIRA)" <ji...@apache.org> on 2018/03/05 03:15:00 UTC

[jira] [Created] (IGNITE-7879) SQL query with group by and distinct in subquery produces JdbcSQLException

Pavel Vinokurov created IGNITE-7879:
---------------------------------------

             Summary: SQL query with group by and distinct in subquery produces JdbcSQLException
                 Key: IGNITE-7879
                 URL: https://issues.apache.org/jira/browse/IGNITE-7879
             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 p.id,sum(p.id) FROM person p
LEFT JOIN (select DISTINCT id from company) as c on c.id=p.company_id
group by p.id

Result:

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

 

 



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