Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group