Re: GIN Indexes: Extensibility

From: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: GIN Indexes: Extensibility
Date: 2016-07-27 15:00:05
Message-ID: 5ce6efd7-c6dc-2dfd-bc37-c797ad6c9d46@illuminatedcomputing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/27/2016 07:44 AM, Vick Khera wrote:
> On Wed, Jul 27, 2016 at 3:28 AM, Anton Ananich <anton(dot)ananich(at)gmail(dot)com> 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.

FWIW, Postgres arrays do sort in the way he's expecting:

paul=# create table t (id integer, v integer[]);
CREATE TABLE
paul=# insert into t values (1, array[2014]), (2, array[2014, 1]), (3,
array[2016]);
INSERT 0 3
paul=# select * from t order by v;
id | v
----+----------
1 | {2014}
2 | {2014,1}
3 | {2016}
(3 rows)

So maybe convert to an array before sorting?

Paul

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-07-27 15:01:18 Re: low perfomances migrating from 9.3 to 9.5
Previous Message thomas veymont 2016-07-27 14:52:38 Re: low perfomances migrating from 9.3 to 9.5