planner does not detect same-as-default collation.

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: planner does not detect same-as-default collation.
Date: 2016-01-05 05:39:42
Message-ID: CAMkU=1zm5d9TErbmCrB4uXP5oG31dmq=w6x697GFEeqJtuBQ6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I don't know if this is a bug, or a surprising feature, or just a
misunderstanding.

If I specify an explicit collation which happens to be the same as the
default collation, it is not recognized as being the same as the
default.

select version();
version
---------------------------------------------------------------------------------------------------------------
PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.4.7 20120313 (Red Hat 4.4.7-16), 64-bit

(But also in at least 9.5rc1 and 9.6dev)

create database test2 encoding='utf8' lc_collate='en_US.utf8'
template=template0;
\c test2
create table foo as select generate_series::text as bar from
generate_series(1,100000);
create index on foo (bar );
cluster foo USING foo_bar_idx ;
set enable_sort TO off;
explain select * from foo order by bar;

<walks the index>

explain select * from foo order by bar collate "en_US.utf8";

<does the sort>

Am I the only one surprised by this?

Cheers,

Jeff

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Arthur Pemberton 2016-01-05 05:39:47 Re: Cannot upgrade from 9.3 to 9.4 using pg_upgrade
Previous Message Michael Paquier 2016-01-05 03:40:40 Re: Please help! Server process was terminated by signal 11: Segmentation fault