pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
citext on exclude using gist
3+ messages / 3 participants
[nested] [flat]

* citext on exclude using gist
@ 2022-07-19 23:31  Jean Carlo Giambastiani Lopes <jean.lopes@hotmail.com.br>
  0 siblings, 1 reply; 3+ messages in thread

From: Jean Carlo Giambastiani Lopes @ 2022-07-19 23:31 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi,

I'm trying to use a citext column in the following manner without success:

create extension btree_gist;
create extension citext;
create table my_table(
    foo citext,
    bar numrange,
    primary key (foo, bar),
    exclude using gist (foo with =, bar with &&)
);

is this possible? If so, what's wrong on this snippet?


Regards,
Jean Lopes

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: citext on exclude using gist
@ 2022-07-19 23:43  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jean Carlo Giambastiani Lopes <jean.lopes@hotmail.com.br>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2022-07-19 23:43 UTC (permalink / raw)
  To: Jean Carlo Giambastiani Lopes <jean.lopes@hotmail.com.br>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Jean Carlo Giambastiani Lopes <jean.lopes@hotmail.com.br> writes:
> I'm trying to use a citext column in the following manner without success:

> create extension btree_gist;
> create extension citext;
> create table my_table(
>     foo citext,
>     bar numrange,
>     primary key (foo, bar),
>     exclude using gist (foo with =, bar with &&)
> );

> is this possible? If so, what's wrong on this snippet?

btree_gist knows nothing of citext, so it's not providing any suitable
operator class.

(Code-wise it probably wouldn't be that hard to add, but I see no good way
to deal with the inter-extension connection other than to give btree_gist
a hard dependency on citext, which people wouldn't appreciate too much.)

You could fake it with

    exclude using gist (lower(foo) with =, bar with &&)

which is surely conceptually ugly, but I think it gives compatible
semantics.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: citext on exclude using gist
@ 2022-07-19 23:49  David G. Johnston <david.g.johnston@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2022-07-19 23:49 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jean Carlo Giambastiani Lopes <jean.lopes@hotmail.com.br>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On Tue, Jul 19, 2022 at 4:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Jean Carlo Giambastiani Lopes <jean.lopes@hotmail.com.br> writes:
> > I'm trying to use a citext column in the following manner without
> success:
>
> > create extension btree_gist;
> > create extension citext;
> > create table my_table(
> >     foo citext,
> >     bar numrange,
> >     primary key (foo, bar),
> >     exclude using gist (foo with =, bar with &&)
> > );
>
> > is this possible? If so, what's wrong on this snippet?
>
> btree_gist knows nothing of citext, so it's not providing any suitable
> operator class.
>
> (Code-wise it probably wouldn't be that hard to add, but I see no good way
> to deal with the inter-extension connection other than to give btree_gist
> a hard dependency on citext, which people wouldn't appreciate too much.)
>
>
I'd expect that creating a "btree_gist_citext" extension would provide a
pathway forward here.  IIUC, it could even depend on the two extensions it
is expanding upon.

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-07-19 23:49 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 23:31 citext on exclude using gist Jean Carlo Giambastiani Lopes <jean.lopes@hotmail.com.br>
2022-07-19 23:43 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-07-19 23:49   ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox