Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCz2Z-00025I-Hq for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Aug 2013 21:37:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VCz2Y-0008JL-T8 for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Aug 2013 21:37:06 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCz17-0007Gk-7g for pgsql-bugs@postgresql.org; Fri, 23 Aug 2013 21:35:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCz14-0004fi-WC for pgsql-bugs@postgresql.org; Fri, 23 Aug 2013 21:35:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id r7NLZY1U022856; Fri, 23 Aug 2013 17:35:34 -0400 From: Tom Lane To: postgresql@realityexists.net cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8393: "ERROR: failed to locate grouping columns" on grouping by varchar returned from function In-reply-to: References: Comments: In-reply-to postgresql@realityexists.net message dated "Fri, 23 Aug 2013 08:25:15 -0000" Date: Fri, 23 Aug 2013 17:35:34 -0400 Message-ID: <22855.1377293734@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org postgresql@realityexists.net writes: > CREATE OR REPLACE FUNCTION test_group_by() > RETURNS TABLE (my_col varchar(5)) > AS $BODY$ > SELECT 'hello'::varchar(5); > $BODY$ LANGUAGE sql STABLE; > SELECT my_col > FROM test_group_by() > GROUP BY 1; > ERROR: failed to locate grouping columns Fixed in our git tree; thanks for the report! As a workaround in this particular case, you could just not bother with marking the specific length of the varchar constant. The function definition essentially ignores the length, storing only "varchar" as the result column type, and it's the discrepancy between that and the declaration of the constant that's tickling the bug. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs