Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 1E1C11337B68 for ; Tue, 10 May 2011 19:36:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 01984-02 for ; Tue, 10 May 2011 22:36:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 7262C1337990 for ; Tue, 10 May 2011 19:36:42 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p4AMaWm6038212 for ; Tue, 10 May 2011 22:36:32 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p4AMaW5e038211; Tue, 10 May 2011 22:36:32 GMT (envelope-from www) Date: Tue, 10 May 2011 22:36:32 GMT Message-Id: <201105102236.p4AMaW5e038211@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6020: Wrong data type returned after CAST in FROM From: "Skylar Hawk" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201105/81 X-Sequence-Number: 30220 The following bug has been logged online: Bug reference: 6020 Logged by: Skylar Hawk Email address: skylar.j.hawk@gmail.com PostgreSQL version: 9.0.3 Operating system: OpenBSD Description: Wrong data type returned after CAST in FROM Details: Hello, 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. 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. -Sky