pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Better handle pseudotypes as partition keys 3+ messages / 1 participants [nested] [flat]
* pgsql: Better handle pseudotypes as partition keys @ 2018-07-10 19:47 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 3+ messages in thread From: Alvaro Herrera @ 2018-07-10 19:47 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Better handle pseudotypes as partition keys We fail to handle polymorphic types properly when they are used as partition keys: we were unnecessarily adding a RelabelType node on top, which confuses code examining the nodes. In particular, this makes predtest.c-based partition pruning not to work, and ruleutils.c to emit expressions that are uglier than needed. Fix it by not adding RelabelType when not needed. In master/11 the new pruning code is separate so it doesn't suffer from this problem, since we already fixed it (in essentially the same way) in e5dcbb88a15d, which also added a few tests; back-patch those tests to pg10 also. But since UPDATE/DELETE still uses predtest.c in pg11, this change improves partitioning for those cases too. Add tests for this. The ruleutils.c behavior change is relevant in pg11/master too. Co-authored-by: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/54745d13-7ed4-54ac-97d8-ea1eec95ae25@lab.ntt.co.jp Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e7df94f317c979ad176adc0155a3e8af63e68ac9 Modified Files -------------- src/backend/partitioning/partbounds.c | 50 +++++++++++---------------- src/test/regress/expected/create_table.out | 2 +- src/test/regress/expected/partition_prune.out | 18 ++++++++++ src/test/regress/sql/partition_prune.sql | 2 ++ 4 files changed, 41 insertions(+), 31 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Better handle pseudotypes as partition keys @ 2018-07-10 19:47 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 3+ messages in thread From: Alvaro Herrera @ 2018-07-10 19:47 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Better handle pseudotypes as partition keys We fail to handle polymorphic types properly when they are used as partition keys: we were unnecessarily adding a RelabelType node on top, which confuses code examining the nodes. In particular, this makes predtest.c-based partition pruning not to work, and ruleutils.c to emit expressions that are uglier than needed. Fix it by not adding RelabelType when not needed. In master/11 the new pruning code is separate so it doesn't suffer from this problem, since we already fixed it (in essentially the same way) in e5dcbb88a15d, which also added a few tests; back-patch those tests to pg10 also. But since UPDATE/DELETE still uses predtest.c in pg11, this change improves partitioning for those cases too. Add tests for this. The ruleutils.c behavior change is relevant in pg11/master too. Co-authored-by: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/54745d13-7ed4-54ac-97d8-ea1eec95ae25@lab.ntt.co.jp Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/b6e3a3a492dbf2043e4b149221007716ba9e364e Modified Files -------------- src/backend/partitioning/partbounds.c | 50 +++++++++++---------------- src/test/regress/expected/create_table.out | 2 +- src/test/regress/expected/partition_prune.out | 18 ++++++++++ src/test/regress/sql/partition_prune.sql | 2 ++ 4 files changed, 41 insertions(+), 31 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Better handle pseudotypes as partition keys @ 2018-07-10 19:47 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 3+ messages in thread From: Alvaro Herrera @ 2018-07-10 19:47 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Better handle pseudotypes as partition keys We fail to handle polymorphic types properly when they are used as partition keys: we were unnecessarily adding a RelabelType node on top, which confuses code examining the nodes. In particular, this makes predtest.c-based partition pruning not to work, and ruleutils.c to emit expressions that are uglier than needed. Fix it by not adding RelabelType when not needed. In master/11 the new pruning code is separate so it doesn't suffer from this problem, since we already fixed it (in essentially the same way) in e5dcbb88a15d, which also added a few tests; back-patch those tests to pg10 also. But since UPDATE/DELETE still uses predtest.c in pg11, this change improves partitioning for those cases too. Add tests for this. The ruleutils.c behavior change is relevant in pg11/master too. Co-authored-by: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/54745d13-7ed4-54ac-97d8-ea1eec95ae25@lab.ntt.co.jp Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7c644b7d3f83b642aac16bc57dfe0de76a7045bb Modified Files -------------- src/backend/catalog/partition.c | 47 +++++------- src/test/regress/expected/create_table.out | 2 +- src/test/regress/expected/inherit.out | 116 +++++++++++++++++++++++++++++ src/test/regress/sql/inherit.sql | 45 +++++++++++ 4 files changed, 180 insertions(+), 30 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-07-10 19:47 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-07-10 19:47 pgsql: Better handle pseudotypes as partition keys Alvaro Herrera <alvherre@alvh.no-ip.org> 2018-07-10 19:47 pgsql: Better handle pseudotypes as partition keys Alvaro Herrera <alvherre@alvh.no-ip.org> 2018-07-10 19:47 pgsql: Better handle pseudotypes as partition keys Alvaro Herrera <alvherre@alvh.no-ip.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox