Re: BUG #6020: Wrong data type returned after CAST in FROM

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Skylar Hawk" <skylar(dot)j(dot)hawk(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6020: Wrong data type returned after CAST in FROM
Date: 2011-05-11 17:04:59
Message-ID: 570.1305133499@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Skylar Hawk" <skylar(dot)j(dot)hawk(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-05-11 17:40:10 Re: BUG #6020: Wrong data type returned after CAST in FROM
Previous Message Bruce Momjian 2011-05-11 14:25:39 Re: Changed behaviour of \'