pgsql: Mark built-in btree comparison functions as leakproof whereit's
От | Tom Lane |
---|---|
Тема | pgsql: Mark built-in btree comparison functions as leakproof whereit's |
Дата | |
Msg-id | E1fdNtc-00031T-Ns@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Mark built-in btree comparison functions as leakproof where it's safe. Generally, if the comparison operators for a datatype or pair of datatypes are leakproof, the corresponding btree comparison support function can be considered so as well. But we had not originally worried about marking support functions as leakproof, reasoning that they'd not likely be used in queries so the marking wouldn't matter. It turns out there's at least one place where it does matter: calc_arraycontsel() finds the target datatype's default btree comparison function and tries to use that to estimate selectivity, but it will be blocked in some cases if the function isn't leakproof. This leads to unnecessarily poor selectivity estimates and bad plans, as seen in bug #15251. Hence, run around and apply proleakproof markings where the corresponding btree comparison operators are leakproof. (I did eyeball each function to verify that it wasn't doing anything surprising, too.) This isn't a full solution to bug #15251, and it's not back-patchable because of the need for a catversion bump. A more useful response probably is to consider whether we can check permissions on the parent table instead of the child. However, this change will help in some cases where that won't, and it's easy enough to do in HEAD, so let's do so. Discussion: https://postgr.es/m/3876.1531261875@sss.pgh.pa.us Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/39a96512b3ed72de7b24b2667d9575d7e9fcb326 Modified Files -------------- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 116 +++++++++++++++---------------- src/test/regress/expected/opr_sanity.out | 35 ++++++++++ 3 files changed, 94 insertions(+), 59 deletions(-)
В списке pgsql-committers по дате отправления: