agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Дмитрий Воронин <carriingfate92@yandex.ru>
To: pgsql-sql@lists.postgresql.org <pgsql-sql@lists.postgresql.org>
Date: Tue, 01 Feb 2022 11:42:00 +0300
Message-ID: <506811643704589@mail.yandex.ru> (raw)
<div>Hi all,</div><div> </div><div>I'm using PostgreSQL 13.</div><div> </div><div>I have a table:</div><div> </div><div>CREATE TABLE test(docid integer, jsonb attrs);</div><div> </div><div>So, attrs contains data like</div><div> </div><div>...</div><div>"dates": ["2019-10-02", "2018-02-03"]</div><div>...</div><div> </div><div>So, I want to SELECT all docids, which dates in range:</div><div> </div><div><div>SELECT attrs FROM document_resinfo WHERE attrs @? '$.dates[*].datetime() ? (@ >= "2020-10-02".datetime())';</div><div> </div><div>How can I create index on attrs field to query docids with other date? Thanks.</div></div><div> </div><div>-- <br />Best regards, Dmitry Voronin</div><div> </div>
view thread (5+ messages) latest in thread
Message-ID: <506811643704589@mail.yandex.ru>
Permalink: ../506811643704589@mail.yandex.ru/
Also on: postgresql.org/message-id/506811643704589@mail.yandex.ru
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: carriingfate92@yandex.ru, pgsql-sql@lists.postgresql.org
Subject: Re:
In-Reply-To: <506811643704589@mail.yandex.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox