pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Disallow converting an inheritance child table to a view. 7+ messages / 1 participants [nested] [flat]
* pgsql: Disallow converting an inheritance child table to a view. @ 2021-02-06 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-02-06 20:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Disallow converting an inheritance child table to a view. Generally, members of inheritance trees must be plain tables (or, in more recent versions, foreign tables). ALTER TABLE INHERIT rejects creating an inheritance relationship that has a view at either end. When DefineQueryRewrite attempts to convert a relation to a view, it already had checks prohibiting doing so for partitioning parents or children as well as traditional-inheritance parents ... but it neglected to check that a traditional-inheritance child wasn't being converted. Since the planner assumes that any inheritance child is a table, this led to making plans that tried to do a physical scan on a view, causing failures (or even crashes, in recent versions). One could imagine trying to support such a case by expanding the view normally, but since the rewriter runs before the planner does inheritance expansion, it would take some very fundamental refactoring to make that possible. There are probably a lot of other parts of the system that don't cope well with such a situation, too. For now, just forbid it. Per bug #16856 from Yang Lin. Back-patch to all supported branches. (In versions before v10, this includes back-patching the portion of commit 501ed02cf that added has_superclass(). Perhaps the lack of that infrastructure partially explains the missing check.) Discussion: https://postgr.es/m/16856-0363e05c6e1612fd@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/dd705a039f6cd41921529fa4e971d70b224be052 Modified Files -------------- src/backend/catalog/pg_inherits.c | 12 +++++++----- src/backend/rewrite/rewriteDefine.c | 25 ++++++++++++++++++------- src/test/regress/expected/rules.out | 15 +++++++++++++-- src/test/regress/sql/rules.sql | 16 ++++++++++++++-- 4 files changed, 52 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Disallow converting an inheritance child table to a view. @ 2021-02-06 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-02-06 20:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Disallow converting an inheritance child table to a view. Generally, members of inheritance trees must be plain tables (or, in more recent versions, foreign tables). ALTER TABLE INHERIT rejects creating an inheritance relationship that has a view at either end. When DefineQueryRewrite attempts to convert a relation to a view, it already had checks prohibiting doing so for partitioning parents or children as well as traditional-inheritance parents ... but it neglected to check that a traditional-inheritance child wasn't being converted. Since the planner assumes that any inheritance child is a table, this led to making plans that tried to do a physical scan on a view, causing failures (or even crashes, in recent versions). One could imagine trying to support such a case by expanding the view normally, but since the rewriter runs before the planner does inheritance expansion, it would take some very fundamental refactoring to make that possible. There are probably a lot of other parts of the system that don't cope well with such a situation, too. For now, just forbid it. Per bug #16856 from Yang Lin. Back-patch to all supported branches. (In versions before v10, this includes back-patching the portion of commit 501ed02cf that added has_superclass(). Perhaps the lack of that infrastructure partially explains the missing check.) Discussion: https://postgr.es/m/16856-0363e05c6e1612fd@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4353bc878135da7b9b5b416a6986e23a70a3d9b6 Modified Files -------------- src/backend/catalog/pg_inherits.c | 12 +++++++----- src/backend/rewrite/rewriteDefine.c | 25 ++++++++++++++++++------- src/test/regress/expected/rules.out | 15 +++++++++++++-- src/test/regress/sql/rules.sql | 16 ++++++++++++++-- 4 files changed, 52 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Disallow converting an inheritance child table to a view. @ 2021-02-06 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-02-06 20:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Disallow converting an inheritance child table to a view. Generally, members of inheritance trees must be plain tables (or, in more recent versions, foreign tables). ALTER TABLE INHERIT rejects creating an inheritance relationship that has a view at either end. When DefineQueryRewrite attempts to convert a relation to a view, it already had checks prohibiting doing so for partitioning parents or children as well as traditional-inheritance parents ... but it neglected to check that a traditional-inheritance child wasn't being converted. Since the planner assumes that any inheritance child is a table, this led to making plans that tried to do a physical scan on a view, causing failures (or even crashes, in recent versions). One could imagine trying to support such a case by expanding the view normally, but since the rewriter runs before the planner does inheritance expansion, it would take some very fundamental refactoring to make that possible. There are probably a lot of other parts of the system that don't cope well with such a situation, too. For now, just forbid it. Per bug #16856 from Yang Lin. Back-patch to all supported branches. (In versions before v10, this includes back-patching the portion of commit 501ed02cf that added has_superclass(). Perhaps the lack of that infrastructure partially explains the missing check.) Discussion: https://postgr.es/m/16856-0363e05c6e1612fd@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f7332195708d3eb846938609c52ec2f6be3075e1 Modified Files -------------- src/backend/catalog/pg_inherits.c | 12 +++++++----- src/backend/rewrite/rewriteDefine.c | 25 ++++++++++++++++++------- src/test/regress/expected/rules.out | 15 +++++++++++++-- src/test/regress/sql/rules.sql | 16 ++++++++++++++-- 4 files changed, 52 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Disallow converting an inheritance child table to a view. @ 2021-02-06 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-02-06 20:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Disallow converting an inheritance child table to a view. Generally, members of inheritance trees must be plain tables (or, in more recent versions, foreign tables). ALTER TABLE INHERIT rejects creating an inheritance relationship that has a view at either end. When DefineQueryRewrite attempts to convert a relation to a view, it already had checks prohibiting doing so for partitioning parents or children as well as traditional-inheritance parents ... but it neglected to check that a traditional-inheritance child wasn't being converted. Since the planner assumes that any inheritance child is a table, this led to making plans that tried to do a physical scan on a view, causing failures (or even crashes, in recent versions). One could imagine trying to support such a case by expanding the view normally, but since the rewriter runs before the planner does inheritance expansion, it would take some very fundamental refactoring to make that possible. There are probably a lot of other parts of the system that don't cope well with such a situation, too. For now, just forbid it. Per bug #16856 from Yang Lin. Back-patch to all supported branches. (In versions before v10, this includes back-patching the portion of commit 501ed02cf that added has_superclass(). Perhaps the lack of that infrastructure partially explains the missing check.) Discussion: https://postgr.es/m/16856-0363e05c6e1612fd@postgresql.org Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/580069037cec005ed3b61d233ae87462be91c6d0 Modified Files -------------- src/backend/catalog/pg_inherits.c | 12 +++++++----- src/backend/rewrite/rewriteDefine.c | 25 ++++++++++++++++++------- src/test/regress/expected/rules.out | 15 +++++++++++++-- src/test/regress/sql/rules.sql | 16 ++++++++++++++-- 4 files changed, 52 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Disallow converting an inheritance child table to a view. @ 2021-02-06 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-02-06 20:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Disallow converting an inheritance child table to a view. Generally, members of inheritance trees must be plain tables (or, in more recent versions, foreign tables). ALTER TABLE INHERIT rejects creating an inheritance relationship that has a view at either end. When DefineQueryRewrite attempts to convert a relation to a view, it already had checks prohibiting doing so for partitioning parents or children as well as traditional-inheritance parents ... but it neglected to check that a traditional-inheritance child wasn't being converted. Since the planner assumes that any inheritance child is a table, this led to making plans that tried to do a physical scan on a view, causing failures (or even crashes, in recent versions). One could imagine trying to support such a case by expanding the view normally, but since the rewriter runs before the planner does inheritance expansion, it would take some very fundamental refactoring to make that possible. There are probably a lot of other parts of the system that don't cope well with such a situation, too. For now, just forbid it. Per bug #16856 from Yang Lin. Back-patch to all supported branches. (In versions before v10, this includes back-patching the portion of commit 501ed02cf that added has_superclass(). Perhaps the lack of that infrastructure partially explains the missing check.) Discussion: https://postgr.es/m/16856-0363e05c6e1612fd@postgresql.org Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ad85e5efa1bf6d534c1c519598c2beaaaa5eeb2f Modified Files -------------- src/backend/catalog/pg_inherits.c | 8 +++++--- src/backend/rewrite/rewriteDefine.c | 25 ++++++++++++++++++------- src/test/regress/expected/rules.out | 15 +++++++++++++-- src/test/regress/sql/rules.sql | 16 ++++++++++++++-- 4 files changed, 50 insertions(+), 14 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Disallow converting an inheritance child table to a view. @ 2021-02-06 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-02-06 20:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Disallow converting an inheritance child table to a view. Generally, members of inheritance trees must be plain tables (or, in more recent versions, foreign tables). ALTER TABLE INHERIT rejects creating an inheritance relationship that has a view at either end. When DefineQueryRewrite attempts to convert a relation to a view, it already had checks prohibiting doing so for partitioning parents or children as well as traditional-inheritance parents ... but it neglected to check that a traditional-inheritance child wasn't being converted. Since the planner assumes that any inheritance child is a table, this led to making plans that tried to do a physical scan on a view, causing failures (or even crashes, in recent versions). One could imagine trying to support such a case by expanding the view normally, but since the rewriter runs before the planner does inheritance expansion, it would take some very fundamental refactoring to make that possible. There are probably a lot of other parts of the system that don't cope well with such a situation, too. For now, just forbid it. Per bug #16856 from Yang Lin. Back-patch to all supported branches. (In versions before v10, this includes back-patching the portion of commit 501ed02cf that added has_superclass(). Perhaps the lack of that infrastructure partially explains the missing check.) Discussion: https://postgr.es/m/16856-0363e05c6e1612fd@postgresql.org Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7736ab05fe839ee09386701ca1c992834f9af56a Modified Files -------------- src/backend/catalog/pg_inherits.c | 26 ++++++++++++++++++++++++++ src/backend/rewrite/rewriteDefine.c | 19 +++++++++++++------ src/include/catalog/pg_inherits_fn.h | 1 + src/test/regress/expected/rules.out | 11 +++++++++++ src/test/regress/sql/rules.sql | 11 +++++++++++ 5 files changed, 62 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Disallow converting an inheritance child table to a view. @ 2021-02-06 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2021-02-06 20:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Disallow converting an inheritance child table to a view. Generally, members of inheritance trees must be plain tables (or, in more recent versions, foreign tables). ALTER TABLE INHERIT rejects creating an inheritance relationship that has a view at either end. When DefineQueryRewrite attempts to convert a relation to a view, it already had checks prohibiting doing so for partitioning parents or children as well as traditional-inheritance parents ... but it neglected to check that a traditional-inheritance child wasn't being converted. Since the planner assumes that any inheritance child is a table, this led to making plans that tried to do a physical scan on a view, causing failures (or even crashes, in recent versions). One could imagine trying to support such a case by expanding the view normally, but since the rewriter runs before the planner does inheritance expansion, it would take some very fundamental refactoring to make that possible. There are probably a lot of other parts of the system that don't cope well with such a situation, too. For now, just forbid it. Per bug #16856 from Yang Lin. Back-patch to all supported branches. (In versions before v10, this includes back-patching the portion of commit 501ed02cf that added has_superclass(). Perhaps the lack of that infrastructure partially explains the missing check.) Discussion: https://postgr.es/m/16856-0363e05c6e1612fd@postgresql.org Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5ad03374bfe74ebdea937461170c1567671e11e0 Modified Files -------------- src/backend/catalog/pg_inherits.c | 26 ++++++++++++++++++++++++++ src/backend/rewrite/rewriteDefine.c | 19 +++++++++++++------ src/include/catalog/pg_inherits_fn.h | 1 + src/test/regress/expected/rules.out | 11 +++++++++++ src/test/regress/sql/rules.sql | 11 +++++++++++ 5 files changed, 62 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2021-02-06 20:17 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-02-06 20:17 pgsql: Disallow converting an inheritance child table to a view. Tom Lane <tgl@sss.pgh.pa.us> 2021-02-06 20:17 pgsql: Disallow converting an inheritance child table to a view. Tom Lane <tgl@sss.pgh.pa.us> 2021-02-06 20:17 pgsql: Disallow converting an inheritance child table to a view. Tom Lane <tgl@sss.pgh.pa.us> 2021-02-06 20:17 pgsql: Disallow converting an inheritance child table to a view. Tom Lane <tgl@sss.pgh.pa.us> 2021-02-06 20:17 pgsql: Disallow converting an inheritance child table to a view. Tom Lane <tgl@sss.pgh.pa.us> 2021-02-06 20:17 pgsql: Disallow converting an inheritance child table to a view. Tom Lane <tgl@sss.pgh.pa.us> 2021-02-06 20:17 pgsql: Disallow converting an inheritance child table to a view. Tom Lane <tgl@sss.pgh.pa.us>
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