Re: [GENERAL] GIN Indexes: Extensibility

2016-07-28 Thread Anton Ananich
Paul, This is a really valuable idea. It will work in some situations for me. But in other situations I do not know if table will have a key of type int[] or string[] or even mixed. That’s why I’d wish to use JSON arrays and customize sort ordering. Anyway I appreciate you shared this approach

Re: [GENERAL] GIN Indexes: Extensibility

2016-07-28 Thread Anton Ananich
Vick, you are right. That’s why I’d wish to add some custom code to MY PostgreSQL instance and set such a sort order, which is optimal for my application. On Jul 27, 2016, at 17:44, Vick Khera wrote: > On Wed, Jul 27, 2016 at 3:28 AM, Anton Ananich > wrote: >> In my situation this order is i

Re: [GENERAL] GIN Indexes: Extensibility

2016-07-27 Thread Paul Jungwirth
On 07/27/2016 07:44 AM, Vick Khera wrote: On Wed, Jul 27, 2016 at 3:28 AM, Anton Ananich wrote: In my situation this order is invalid. Obviously, year 2016 should go after 2014, like that: I think you expect JSONB to sort differently than it does. I cannot imagine what a "natural" ordering of

Re: [GENERAL] GIN Indexes: Extensibility

2016-07-27 Thread Vick Khera
On Wed, Jul 27, 2016 at 3:28 AM, Anton Ananich wrote: > In my situation this order is invalid. Obviously, year 2016 should go after > 2014, like that: I think you expect JSONB to sort differently than it does. I cannot imagine what a "natural" ordering of arbitrary JSON objects is. -- Sent via

[GENERAL] GIN Indexes: Extensibility

2016-07-27 Thread Anton Ananich
Dear All, Here is what I have: user=# create table FOO (key jsonb); CREATE TABLE user=# insert into FOO(key) values ('[2014]'), ('[2015]'), ('[2016]'), ('[2014, 2]'), ('[2014, 2, 3]'), ('[2014, 3]'), ('[2014,2,4]'), ('[2014, 2,4]'), ('[2014,3,13]'), ('[2014, 2, 15]'); INSERT 0 10 user=# SELECT