Coder Social home page Coder Social logo

Comments (2)

jamii avatar jamii commented on May 17, 2024
SELECT DISTINCT * FROM tab0 AS cor0 GROUP BY cor0.col0, cor0.col1, cor0.col0, cor0.col2
InferenceFailure { expected_types: [Integer, Integer, Integer], inferred_types: [Int64, Int64, Int64, Int64] }

Similarly, this query repeated cor0.col0 twice in the output because it is used twice in the GROUP BY, but * should only pick things from before group by / aggregate.

from materialize.

jamii avatar jamii commented on May 17, 2024

These rules are ridiculous:

postgres=# select * from foo;
 a | b 
---+---
 1 | 7
(1 row)

postgres=# select * from foo group by a;
ERROR:  column "foo.b" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select * from foo group by a;
               ^

postgres=# select * from foo group by a,b;
 a | b 
---+---
 1 | 7
(1 row)

postgres=# select * from foo group by a,a,b;
 a | b 
---+---
 1 | 7
(1 row)

postgres=# select * from foo group by a,a+1,b;
 a | b 
---+---
 1 | 7
(1 row)

postgres=# select a+1 from foo group by a,a+1;
 ?column? 
----------
        2
(1 row)

postgres=# select a+2 from foo group by a,a+1;
 ?column? 
----------
        3
(1 row)

postgres=# select a+2 from foo group by a+1;
ERROR:  column "foo.a" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select a+2 from foo group by a+1;
               ^

postgres=# select (a+1)+1 from foo group by a+1;
 ?column? 
----------
        3
(1 row)

from materialize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.