Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 76B0E1337BA8 for ; Wed, 11 May 2011 14:40:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 73252-09 for ; Wed, 11 May 2011 17:40:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 369691337B80 for ; Wed, 11 May 2011 14:40:12 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p4BHeA0B001751; Wed, 11 May 2011 13:40:10 -0400 (EDT) To: Skylar Hawk cc: pgsql-bugs@postgreSQL.org Subject: Re: BUG #6020: Wrong data type returned after CAST in FROM In-reply-to: References: <201105102236.p4AMaW5e038211@wwwmaster.postgresql.org> <570.1305133499@sss.pgh.pa.us> Comments: In-reply-to Skylar Hawk message dated "Wed, 11 May 2011 10:31:08 -0700" Date: Wed, 11 May 2011 13:40:10 -0400 Message-ID: <1750.1305135610@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/92 X-Sequence-Number: 30231 Skylar Hawk writes: > I got the similar results when I ran similar queries from a ruby > script using the 'postgres' gem as well, which notified me of the > difference through the error message. That's actually what alerted me > to it first. The script calls a plpsql function which expects a > CHAR(8) and the script died. The database message said the function > was expecting a CHAR(8) but got a BPCHAR instead. OK, now I'm really unsure what you're talking about. There's no such thing as a plpgsql function that "expects a char(8)" --- well, you can declare it that way, but the database just ignores the length modifier. And BPCHAR is just the internal name for CHAR(n), so it should certainly have matched. Could we see the *exact* function declaration, the exact SQL you issued, and the exact error message, rather than ambiguous descriptions? regards, tom lane