Re: DISTINCT ON clause

2018-04-09 Thread Julian Hyde
tive types and array or map type columns. >>>>>>> I do see your point about the Postgres semantics of ORDER BY vs >>> DISTINCT >>>>>>> ON. >>>>>>> I don't like the hidden semantics of MySQL either. >>>>>

Re: DISTINCT ON clause

2018-04-09 Thread Chris Baynes
t;>> I do see your point about the Postgres semantics of ORDER BY vs > > > DISTINCT > > > >>>> ON. > > > >>>> I don't like the hidden semantics of MySQL either. > > > >>>> Perhaps the compromise solution is to introduce functi

Re: DISTINCT ON clause

2018-04-04 Thread Aman Sinha
t; > >>>> Perhaps the compromise solution is to introduce functions such as > > >>>> FIRST_ROW() aggregation function (similar to lead/lag window > > functions) > > >>> and > > >>>> use GROUP BY. > > >&

Re: DISTINCT ON clause

2018-03-07 Thread Gian Merlino
PM, Julian Hyde <jh...@apache.org> > wrote: > >>>> > >>>>> I can see that it would be useful. But there are a couple of things > >>> about > >>>>> it that are messy. > >>>>> > >>>>> I think the

Re: DISTINCT ON clause

2018-03-07 Thread Julian Hyde
messy. >>>>> >>>>> I think the syntax is a bit clunky because it uses parentheses; a query >>>>> would be difficult to read if people would like multiple columns, >>>>> expressions, and aliases. >>>>> >>>>> I also think

Re: DISTINCT ON clause

2018-03-04 Thread Aman Sinha
ple would like multiple columns, >> >> expressions, and aliases. >> >> >> >> I also think the semantics are messy. If you read >> >> https://www.postgresql.org/docs/9.5/static/sql-select.html# >> SQL-DISTINCT < >> >> ht

Re: DISTINCT ON clause

2018-02-22 Thread Aman Sinha
yntax is a bit clunky because it uses parentheses; a query > >> would be difficult to read if people would like multiple columns, > >> expressions, and aliases. > >> > >> I also think the semantics are messy. If you read > >> https://www.postgresql.org/docs/9.5

Re: DISTINCT ON clause

2018-02-21 Thread Julian Hyde
//www.postgresql.org/docs/9.5/static/sql-select.html#SQL-DISTINCT> >> you will see that “DISTINCT ON” is evaluated after the ORDER BY clause, >> whereas regular DISTINCT is evaluated before the ORDER BY clause. So there >> will be a bizarre interaction if DISTINCT ON is used w

Re: DISTINCT ON clause

2018-02-21 Thread Aman Sinha
atic/sql-select.html#SQL-DISTINCT < > https://www.postgresql.org/docs/9.5/static/sql-select.html#SQL-DISTINCT> > you will see that “DISTINCT ON” is evaluated after the ORDER BY clause, > whereas regular DISTINCT is evaluated before the ORDER BY clause. So there > will be a bizarre inte

Re: DISTINCT ON clause

2018-02-21 Thread Julian Hyde
. If you read https://www.postgresql.org/docs/9.5/static/sql-select.html#SQL-DISTINCT <https://www.postgresql.org/docs/9.5/static/sql-select.html#SQL-DISTINCT> you will see that “DISTINCT ON” is evaluated after the ORDER BY clause, whereas regular DISTINCT is evaluated before the ORDER BY

DISTINCT ON clause

2018-02-21 Thread Aman Sinha
The DISTINCT 'ON' clause is not supported but I am trying to see if there are other people who have run into this. One of the use cases I have intuitively maps to something like this: SELECT DISTINCT *ON (a)*, b, c FROM T Here suppose 'a' is an INT and b, c are some complex types