Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D064CB5DBBF for ; Thu, 16 Jun 2011 10:28:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 85447-06 for ; Thu, 16 Jun 2011 13:28:21 +0000 (UTC) X-Greylist: delayed 00:22:41.754154 by SQLgrey-1.7.6 Received: from orion.carnet.hr (orion.CARNet.hr [161.53.160.90]) by mail.postgresql.org (Postfix) with ESMTP id C3477B5DBC0 for ; Thu, 16 Jun 2011 10:28:21 -0300 (ADT) Received: from joy by orion.carnet.hr with local (Exim 4.72) (envelope-from ) id 1QXCGP-0003RW-Du for pgsql-bugs@postgresql.org; Thu, 16 Jun 2011 15:05:37 +0200 Date: Thu, 16 Jun 2011 15:05:37 +0200 From: Josip Rodin To: pgsql-bugs@postgresql.org Subject: Re: BUG #6020: Wrong data type returned after CAST in FROM Message-ID: <20110616130537.GB24347@entuzijast.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201105102236.p4AMaW5e038211@wwwmaster.postgresql.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-SA-Exim-Connect-IP: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.414 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FAKE_REPLY_C=1.486 X-Spam-Level: X-Archive-Number: 201106/123 X-Sequence-Number: 30502 Hi there, I've no idea if this is the proper way to append information about an existing bug report, please advise if not. The bug #6020 seems to have bit me, too, this kind of a query fails under PostgreSQL 9.0.4: SELECT * FROM acl_get_list('news', 258, 0); ERROR: wrong record type supplied in RETURN NEXT DETAIL: Returned type bpchar does not match expected type character(4) in column 3. CONTEXT: PL/pgSQL function "acl_get_list" line 9 at RETURN NEXT Where the code is: CREATE TYPE acl_list AS ( ugid integer, isuser boolean, acl_id CHAR(4) [...] ); CREATE OR REPLACE FUNCTION acl_get_list(CHAR(4), INTEGER, INTEGER) RETURNS SETOF acl_list AS ' DECLARE p_acl_id ALIAS FOR $1; p_acl_object_id ALIAS FOR $2; p_lev ALIAS FOR $3; rec RECORD; rec1 RECORD; BEGIN [...] FOR rec IN SELECT * FROM acl_inherits WHERE acl_id = p_acl_id AND object_id = p_acl_object_id LOOP FOR rec1 IN SELECT * FROM acl_get_list(rec.parent_acl_id, rec.parent_object_id, p_lev + 1) LOOP RETURN NEXT rec1; END LOOP; END LOOP; [...] This worked just fine in 8.1, 8.3, 8.4, and doesn't seem wrong. (Coupled with http://bugs.debian.org/630569, this upgrade cycle has not been happy at all for me... :() -- 2. That which causes joy or happiness.