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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dian M Fay" <dian(dot)m(dot)fay(at)gmail(dot)com>
Cc: "David Steele" <david(at)pgmasters(dot)net>, "Georgios Kokolatos" <gkokolatos(at)protonmail(dot)com>, "PostgreSQL Developers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)
Date: 2021-11-11 20:36:53
Message-ID: 1612595.1636663013@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Dian M Fay" <dian(dot)m(dot)fay(at)gmail(dot)com> writes:
> 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?

I thought about this some more and realized exactly why I wanted to
restrict the change to cases where the other side is a plain foreign Var:
that way, if anything surprising happens, we can blame it directly on the
user having declared a local column with a different type from the
remote column.

That being the case, I took a closer look at deparseVar and realized that
we can't simply check "IsA(node, Var)": some Vars in the expression can
belong to local tables. We need to verify that the Var is one that will
print as a remote column reference.

So that leads me to v8, attached. I think we are getting there.

regards, tom lane

Attachment Content-Type Size
v8-0001-Suppress-explicit-casts.patch text/x-diff 24.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-11-11 20:44:27 Re: Test::More version
Previous Message Alvaro Herrera 2021-11-11 20:31:59 Re: Test::More version