pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #8393: "ERROR: failed to locate grouping columns" on grouping by varchar returned from function
2+ messages / 2 participants
[nested] [flat]
* BUG #8393: "ERROR: failed to locate grouping columns" on grouping by varchar returned from function
@ 2013-08-23 08:25 postgresql@realityexists.net
2013-08-23 21:35 ` Re: BUG #8393: "ERROR: failed to locate grouping columns" on grouping by varchar returned from function Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: postgresql@realityexists.net @ 2013-08-23 08:25 UTC (permalink / raw)
To: pgsql-bugs
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #8393: "ERROR: failed to locate grouping columns" on grouping by varchar returned from function
2013-08-23 08:25 BUG #8393: "ERROR: failed to locate grouping columns" on grouping by varchar returned from function postgresql@realityexists.net
@ 2013-08-23 21:35 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2013-08-23 21:35 UTC (permalink / raw)
To: postgresql@realityexists.net; +Cc: pgsql-bugs
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-08-23 21:35 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23 08:25 BUG #8393: "ERROR: failed to locate grouping columns" on grouping by varchar returned from function postgresql@realityexists.net
2013-08-23 21:35 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox