pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mariel Cherkassky <mariel.cherkassky@gmail.com>
Cc: Félix GERZAGUET <felix.gerzaguet@gmail.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: distinct on extract returns composite type
Date: Mon, 30 Sep 2019 09:48:16 -0400
Message-ID: <23495.1569851296@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+t6e1=yZEKMGT_qmJHB7E6Rj2S+G06mr4DL=ZDNo9Ru4DGr=w@mail.gmail.com>
References: <CA+t6e1=FjpvAOwGXveustdC11VbSBrZ2_pVKGKaVFqAvVJh+QQ@mail.gmail.com>
	<CANVwZtuzT1w0aVQMyBi+U=d7e_HQmB70THnqZoxu=xooVRvhbA@mail.gmail.com>
	<CA+t6e1=yZEKMGT_qmJHB7E6Rj2S+G06mr4DL=ZDNo9Ru4DGr=w@mail.gmail.com>

Mariel Cherkassky <mariel.cherkassky@gmail.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





view thread (6+ messages)  latest in thread

Message-ID: <23495.1569851296@sss.pgh.pa.us>
Permalink:  ../23495.1569851296@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23495.1569851296@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mariel.cherkassky@gmail.com, felix.gerzaguet@gmail.com, pgsql-performance@lists.postgresql.org
  Subject: Re: distinct on extract returns composite type
  In-Reply-To: <23495.1569851296@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox