Re: jsonb, collection & postgres_fdw - Mailing list pgsql-hackers

From Tom Lane
Subject Re: jsonb, collection & postgres_fdw
Date
Msg-id 469809.1597338022@sss.pgh.pa.us
Whole thread Raw
In response to jsonb, collection & postgres_fdw  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
Responses Re: jsonb, collection & postgres_fdw
List pgsql-hackers
Konstantin Knizhnik <k.knizhnik@postgrespro.ru> writes:
> Right now jsonb functions are treated as non-shippable by postgres_fdw 
> and so predicates with them are not pushed down to foreign server:

Yeah, that's kind of annoying, but breaking the collation check
is not an acceptable fix.  And what you're proposing *does* break it.
The issue here is that the function's input collation is coming from
the default collation applied to the text constant, and we can't assume
that that will be the same on the remote side.

In reality, of course, jsonb_exists doesn't care about its input collation
--- but postgres_fdw has no way to know that.  I don't see any easy way
around that.

One idea that would probably work in a lot of postgres_fdw usage scenarios
is to have a foreign-server-level flag that says "all the collations on
that server behave the same as the local ones, and the default collation
is the same too", and then we just skip the collation checking altogether.
But I'm a bit worried that if someone mistakenly sets that flag, the
misbehavior will be very hard to detect.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: run pgindent on a regular basis / scripted manner
Next
From: Konstantin Knizhnik
Date:
Subject: Re: jsonb, collection & postgres_fdw