Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)
| От | Tom Lane |
|---|---|
| Тема | Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types) |
| Дата | |
| Msg-id | 1001757.1636408225@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types) ("Dian M Fay" <dian.m.fay@gmail.com>) |
| Ответы |
Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)
|
| Список | pgsql-hackers |
"Dian M Fay" <dian.m.fay@gmail.com> writes:
> On Tue Nov 2, 2021 at 7:10 PM EDT, Tom Lane wrote:
>> Actually ... we could make that a lot safer by insisting that the
>> other input be a plain Var, which'd necessarily be a column of the
>> foreign table. That would still cover most cases of practical
>> interest, I think, and it would remove any question of whether
>> implicit coercions had snuck in. It's more restrictive than I'd
>> really like, but I think it's less likely to cause problems.
> I allowed RelabelTypes over Vars to suppress casts as well. It's working
> for me so far and the varchar comparison tests are back to passing, sans
> casts.
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.
regards, tom lane
В списке pgsql-hackers по дате отправления: