Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types) - Mailing list pgsql-hackers

From Dian M Fay
Subject Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)
Date
Msg-id CFMONXXN7M8X.1POLWWMAZ8ZMH@lamia
Whole thread Raw
In response to Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)
List pgsql-hackers
On Mon Nov 8, 2021 at 4:50 PM EST, Tom Lane wrote:
> Um. I doubt that that's any safer than the v5 patch. As an example,
> casting between int4 and oid is just a RelabelType, but the comparison
> semantics change completely (signed vs. unsigned); so there's not a
> good reason to think this is constraining things more than v5 did.
>
> It might be better if you'd further restricted the structure to be only
> COERCE_IMPLICIT_CAST RelabelTypes, since we don't normally make casts
> implicit if they significantly change semantics. Also, this'd ensure
> that the operand printed for the remote server is just a bare Var
> (cf. deparseRelabelType). But even with that I'm feeling antsy about
> whether this will allow any semantic surprises.

I've split the suppression for RelabelTypes with implicit cast check
into a second patch over the core v7 change. As far as testing goes, \dC
lists implicit casts, but most of those I've tried seem to wind up
deparsing as Vars. I've been able to manifest RelabelTypes with varchar,
cidr, and remote char to local varchar, but that's about it. Any ideas
for validating it further, off the top of your head?

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [BUG]Invalidate relcache when setting REPLICA IDENTITY
Next
From: David Rowley
Date:
Subject: Re: jsonb crash