Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCmgR-0003WY-DK for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Aug 2013 08:25:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VCmgQ-0004LS-QQ for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Aug 2013 08:25:26 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCmgP-0004LL-QB for pgsql-bugs@postgresql.org; Fri, 23 Aug 2013 08:25:25 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCmgL-0007MF-H5 for pgsql-bugs@postgresql.org; Fri, 23 Aug 2013 08:25:25 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCmgK-0002k7-LS for pgsql-bugs@postgresql.org; Fri, 23 Aug 2013 08:25:21 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.80) (envelope-from ) id 1VCmgF-0001uF-9I for pgsql-bugs@postgresql.org; Fri, 23 Aug 2013 08:25:15 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: BUG #8393: "ERROR: failed to locate grouping columns" on grouping by varchar returned from function To: pgsql-bugs@postgresql.org From: postgresql@realityexists.net Message-Id: Date: Fri, 23 Aug 2013 08:25:15 +0000 X-Pg-Spam-Score: -2.0 (--) 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 The following bug has been logged on the website: Bug reference: 8393 Logged by: Evan Martin Email address: postgresql@realityexists.net PostgreSQL version: 9.2.4 Operating system: Windows 7 x64 SP1 Description: version(): PostgreSQL 9.2.4, compiled by Visual C++ build 1600, 64-bit Run the following: 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; Expected result: 'hello' Actual result: ERROR: failed to locate grouping columns Interestingly, if the function is marked "VOLATILE" it works. Casting the result to "text" also makes it work. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs