pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Walter Cruz <walter.php@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?
Date: Thu, 15 Feb 2007 13:35:18 +0000
Message-ID: <45D46196.2090003@archonet.com> (raw)
In-Reply-To: <32cabba0702150319v427d5a25s9a6c7f851576baa2@mail.gmail.com>
References: <32cabba0702150319v427d5a25s9a6c7f851576baa2@mail.gmail.com>

Walter Cruz wrote:
> 
> SELECT distinct name from test order by number
> 
> (well, I think that que query doesn't make any sense, but raises the 
> error :) )
> 
> The error: ERROR:  for SELECT DISTINCT, ORDER BY expressions must
> appear in select list is due to a standart implementarion or a design
> decision of postgres?

I think ORDER BY is defined to take place after DISTINCT, which means 
there is no meaningful "number" for it to order by. You could 
arbitrarily choose the first number encountered, but I can't see what 
sense it would make to order by them.

-- 
   Richard Huxton
   Archonet Ltd



view thread (5+ messages)  latest in thread

Message-ID: <45D46196.2090003@archonet.com>
Permalink:  ../45D46196.2090003@archonet.com/
Also on:    postgresql.org/message-id/45D46196.2090003@archonet.com

 · 

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-sql@postgresql.org
  Cc: dev@archonet.com, walter.php@gmail.com
  Subject: Re: "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?
  In-Reply-To: <45D46196.2090003@archonet.com>

* 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