Обсуждение: GSets: Getting collation related error when GSets has text column
Hi,
When we have text column in the GROUPING SETS (and with some specific
order of columns), we are getting error saying
"could not determine which collation to use for string comparison"
Here is the example:
postgres=# select sum(ten) from onek group by rollup(four::text), two
order by 1;
ERROR: could not determine which collation to use for string comparison
HINT: Use the COLLATE clause to set the collation explicitly.
However if we have sql like;
select sum(ten) from onek group by two, rollup(four::text)
order by 1;
It is not failing.
After spending enough time, If I understood the code correctly, we are
re-ordering the sort columns but we are not remapping the grpColIdx
correctly.
Attached patch which attempts to fix this issue. However I am not sure
whether it is correct. But it does not add any new issues as such.
Added few test in the patch as well.
Please have a look.
Thanks
--
When we have text column in the GROUPING SETS (and with some specific
order of columns), we are getting error saying
"could not determine which collation to use for string comparison"
Here is the example:
postgres=# select sum(ten) from onek group by rollup(four::text), two
order by 1;
ERROR: could not determine which collation to use for string comparison
HINT: Use the COLLATE clause to set the collation explicitly.
However if we have sql like;
select sum(ten) from onek group by two, rollup(four::text)
order by 1;
It is not failing.
After spending enough time, If I understood the code correctly, we are
re-ordering the sort columns but we are not remapping the grpColIdx
correctly.
Attached patch which attempts to fix this issue. However I am not sure
whether it is correct. But it does not add any new issues as such.
Added few test in the patch as well.
Please have a look.
Thanks
--
Jeevan B Chalke
Principal Software Engineer, Product Development
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Principal Software Engineer, Product Development
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Вложения
>>>>> "Jeevan" == Jeevan Chalke <jeevan.chalke@enterprisedb.com> writes: Jeevan> Hi, Jeevan> When we have text column in the GROUPING SETS (and with some specificJeevan> order of columns), we are getting errorsayingJeevan> "could not determine which collation to use for string comparison" Good catch. Jeevan> After spending enough time, If I understood the code correctly,Jeevan> we are re-ordering the sort columns but weare not remappingJeevan> the grpColIdx correctly. Yup. Jeevan> Attached patch which attempts to fix this issue. However I amJeevan> not sure whether it is correct. But it doesnot add any newJeevan> issues as such. Added few test in the patch as well. I wouldn't have bothered moving the Assert; it can be removed. Otherwise it looks correct. -- Andrew (irc:RhodiumToad)
Hi, On 2015-07-17 18:55:52 +0530, Jeevan Chalke wrote: > Attached patch which attempts to fix this issue. However I am not sure > whether it is correct. But it does not add any new issues as such. > Added few test in the patch as well. Pushed the fix. Thanks for the report and fix. - Andres