Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)
От | Dian M Fay |
---|---|
Тема | Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types) |
Дата | |
Msg-id | CFJXTVFNL6TE.33YIAJEHJFT1N@lamia обсуждение исходный текст |
Ответ на | 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>) |
Ответы |
Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)
|
Список | pgsql-hackers |
On Tue Nov 2, 2021 at 7:10 PM EDT, Tom Lane wrote: > I wrote: > > Now that I've looked this over I'm starting to feel uncomfortable > > again, because we can't actually be quite sure about how the remote > > parser's heuristic will act. > > 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. Here's v6! I started with restricting cast suppression to Const-Var comparisons as you suggested. A few tests did regress (relative to the unrestricted version) right out of the gate with comparisons to varchar columns, since those become RelabelType nodes instead of Vars. After reading the notes on RelabelType in primnodes.h, I *think* that that "dummy" coercion is distinct from the operator input type coercion you're talking about here: > What we're checking is that leftType and rightType match, but that > condition is applied to the inputs *after implicit type coercion to > the operator's input types*. We can't be entirely sure about what our > parser saw to begin with. Perhaps it'd be a good idea to strip any > implicit coercions on the non-Const input before checking its type. 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.
Вложения
В списке pgsql-hackers по дате отправления: