pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Skylar Hawk <skylar.j.hawk@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6020: Wrong data type returned after CAST in FROM
Date: Wed, 11 May 2011 13:04:59 -0400
Message-ID: <570.1305133499@sss.pgh.pa.us> (raw)
In-Reply-To: <201105102236.p4AMaW5e038211@wwwmaster.postgresql.org>
References: <201105102236.p4AMaW5e038211@wwwmaster.postgresql.org>

"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



view thread (6+ messages)  latest in thread

Message-ID: <570.1305133499@sss.pgh.pa.us>
Permalink:  ../570.1305133499@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/570.1305133499@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, skylar.j.hawk@gmail.com
  Subject: Re: BUG #6020: Wrong data type returned after CAST in FROM
  In-Reply-To: <570.1305133499@sss.pgh.pa.us>
  References: <201105102236.p4AMaW5e038211@wwwmaster.postgresql.org> <570.1305133499@sss.pgh.pa.us>

* 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