GSets: Getting collation related error when GSets has text column

From: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Postgres-Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: GSets: Getting collation related error when GSets has text column
Date: 2015-07-17 13:25:52
Message-ID: CAM2+6=W=9=hQOipH0HAPbkun3Z3TFWij_EiHue0_6UX=oR=1kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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

--
Jeevan B Chalke
Principal Software Engineer, Product Development
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Attachment Content-Type Size
gsets_fix_collation_bug.patch text/x-diff 2.7 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kouhei Sutou 2015-07-17 14:01:36 Re: BUG #13500: Windows binary zip doesn't include libintl.h
Previous Message Michael Paquier 2015-07-17 13:22:44 Re: BUG #13500: Windows binary zip doesn't include libintl.h

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien 2015-07-17 13:50:06 pgbench stats per script & other stuff
Previous Message Robert Haas 2015-07-17 13:14:19 Re: [PATCH] Function to get size of asynchronous notification queue