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

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

From: "Skylar Hawk" <skylar(dot)j(dot)hawk(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6020: Wrong data type returned after CAST in FROM
Date: 2011-05-10 22:36:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      6020
Logged by:          Skylar Hawk
Email address:      skylar(dot)j(dot)hawk(at)gmail(dot)com
PostgreSQL version: 9.0.3
Operating system:   OpenBSD
Description:        Wrong data type returned after CAST in FROM


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:

	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:

	CAST('abcd' AS CHAR(4)) AS data

then I am returned 'abcd' and the type is bpchar.

I did not have this issue when I was using Postgres 8.4. I upgraded last
week, and that's when I noticed the issue in a couple database functions I
had written.



pgsql-bugs by date

Next:From: Bruce MomjianDate: 2011-05-10 23:44:35
Subject: Re: Re: [BUGS] BUG #5957: createdb with description and md5 auth forces to provide password twice
Previous:From: Martin PittDate: 2011-05-10 21:11:12
Subject: Re: Changed behaviour of \'

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