Re: distinct on extract returns composite type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com>
Cc: Félix GERZAGUET <felix(dot)gerzaguet(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: distinct on extract returns composite type
Date: 2019-09-30 13:48:16
Message-ID: 23495.1569851296@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com> writes:
> In my query I wrapped the columns with distinct : distinct (extract year...
> , extract quarter..).
> In your query you didnt wrap the columns with distinct but you just
> mentioned it. I guess this is the difference, thanks !

Yeah. DISTINCT does not have an argument, it's just a keyword you
can stick in after SELECT. So what you had as the select's targetlist
was (expr,expr), which is read as an implicit row constructor, that
is the same as ROW(expr,expr). One of many arguably not-well-designed
things about SQL syntax :-(

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mariel Cherkassky 2019-09-30 13:51:14 Re: distinct on extract returns composite type
Previous Message Mariel Cherkassky 2019-09-30 13:42:02 Re: distinct on extract returns composite type