dbTalk Databases Forums  

[BUGS] BUG #1522: there's a syntax error using psql, distinct

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1522: there's a syntax error using psql, distinct in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
DIEGO URRA
 
Posts: n/a

Default [BUGS] BUG #1522: there's a syntax error using psql, distinct - 03-04-2005 , 03:59 PM







The following bug has been logged online:

Bug reference: 1522
Logged by: DIEGO URRA
Email address: diegomann (AT) yahoo (DOT) com
PostgreSQL version: 8.0
Operating system: REDHAT 6.2
Description: there's a syntax error using psql, distinct
Details:

hi!

select distinct(id) from results;
works fine

select distinct(id) || 'xyz' from results;
works fine

select 'abc' || distinct(id) || 'xyz' from resuls;
syntax error

is this a bug? thanks in advance
DIEGO URRA

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply With Quote
  #2  
Old   
Stephan Szabo
 
Posts: n/a

Default Re: [BUGS] BUG #1522: there's a syntax error using psql, distinct - 03-04-2005 , 04:21 PM






On Thu, 3 Mar 2005, DIEGO URRA wrote:

Quote:
The following bug has been logged online:

Bug reference: 1522
Logged by: DIEGO URRA
Email address: diegomann (AT) yahoo (DOT) com
PostgreSQL version: 8.0
Operating system: REDHAT 6.2
Description: there's a syntax error using psql, distinct
Details:

hi!

select distinct(id) from results;
works fine

select distinct(id) || 'xyz' from results;
works fine

select 'abc' || distinct(id) || 'xyz' from resuls;
syntax error

is this a bug? thanks in advance
I don't think so. DISTINCT goes at the front of the select list if used.
I think perhaps you're being mislead by the parens around id in the above
which make it looks as if the distinct is being applied to id in the first
two queries rather than to the full expressions in the select list ( (id)
and (id)|| 'xyz' respectively).


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.