pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rep.dot.nop@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #7644: Missing implicit types of Result and failing type-conversion
Date: Fri, 09 Nov 2012 09:57:45 +0000
Message-ID: <E1TWlLN-0001Kk-0p@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      7644
Logged by:          Bernhard Reutner-Fischer
Email address:      rep.dot.nop@gmail.com
PostgreSQL version: 9.1.6
Operating system:   debian
Description:        

Hi,

According to
http://www.postgresql.org/docs/9.1/static/typeconv-union-case.html

i think that these 2 (separate?) issues are bugs(?)
1)
select distinct on (bug) bug
from (
        select * from (select 'string one' AS bug from generate_series(0,1))
s1
        UNION
        select * from (select 'string two' bug from generate_series(0,0))
s2
     ) x
;
ERROR:  could not determine which collation to use for string comparison
HINT:  Use the COLLATE clause to set the collation explicitly.

When casting the return value of the union to :text _explicitly_ it works as
expected:
select distinct on (bug) bug
from (
        select * from (select 'string one'::text AS bug from
generate_series(0,1)) s1
        UNION
        select * from (select 'string two' bug from generate_series(0,0))
s2
     ) x
;
    bug     
------------
 string one
 string two
(2 rows)

2)
select distinct on (bug) bug
from (
        select * from (select 'string one' AS bug from generate_series(0,1))
s1
        UNION
        select * from (select 'string two' bug) s2
     ) x
;
ERROR:  failed to find conversion function from unknown to text

In this case, however, using a "Result" fails to implicitly typecast to
:text, i.e. casting the return value of the first return value of the union
to :text explicitly does _not_ work:

select distinct on (bug) bug
from (
        select * from (select 'string one'::text AS bug from
generate_series(0,1)) s1
        UNION
        select * from (select 'string two' bug ) s2                        

     ) x
;
ERROR:  failed to find conversion function from unknown to text

What am i missing or doing wrong?
thanks and cheers,





view thread (5+ messages)  latest in thread

Message-ID: <E1TWlLN-0001Kk-0p@wrigleys.postgresql.org>
Permalink:  ../E1TWlLN-0001Kk-0p@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1TWlLN-0001Kk-0p@wrigleys.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: rep.dot.nop@gmail.com
  Subject: Re: BUG #7644: Missing implicit types of Result and failing type-conversion
  In-Reply-To: <E1TWlLN-0001Kk-0p@wrigleys.postgresql.org>
  References: <E1TWlLN-0001Kk-0p@wrigleys.postgresql.org>

* 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