Re: BUG #6020: Wrong data type returned after CAST in FROM - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #6020: Wrong data type returned after CAST in FROM
Date
Msg-id 570.1305133499@sss.pgh.pa.us
Whole thread Raw
In response to BUG #6020: Wrong data type returned after CAST in FROM  ("Skylar Hawk" <skylar.j.hawk@gmail.com>)
List pgsql-bugs
"Skylar Hawk" <skylar.j.hawk@gmail.com> writes:
> I noticed a strange nuance. When I do a regular select on data that I CAST
> as a CHAR(), the data I am returned is of type character() as I would
> expect. For example:
> SELECT
>     CAST('abcd' AS CHAR(4)) AS data
> This returns 'abcd' where the type is character(4).
> However, if I do the cast in the FROM portion of the query such as this:
> SELECT
>     data
> FROM
>     CAST('abcd' AS CHAR(4)) AS data
> then I am returned 'abcd' and the type is bpchar.

What exactly are you using to identify the type?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Changed behaviour of \'
Next
From: Tom Lane
Date:
Subject: Re: BUG #6020: Wrong data type returned after CAST in FROM