pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix dependency handling of column drop with partitioned tables
5+ messages / 2 participants
[nested] [flat]
* pgsql: Fix dependency handling of column drop with partitioned tables
@ 2019-10-13 08:54 Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 5+ messages in thread
From: Michael Paquier @ 2019-10-13 08:54 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix dependency handling of column drop with partitioned tables
When dropping a column on a partitioned table which has one or more
partitioned indexes, the operation was failing as dependencies with
partitioned indexes using the column dropped were not getting removed in
a way consistent with the columns involved across all the relations part
of an inheritance tree.
This commit refactors the code executing column drop so as all the
columns from an inheritance tree to remove are gathered first, and
dropped all at the end. This way, we let the dependency machinery sort
out by itself the deletion of all the columns with the partitioned
indexes across a partition tree.
This issue has been introduced by 1d92a0c, so backpatch down to
REL_12_STABLE.
Author: Amit Langote, Michael Paquier
Reviewed-by: Álvaro Herrera, Ashutosh Sharma
Discussion: https://postgr.es/m/CA+HiwqE9kuBsZ3b5pob2-cvE8ofzPWs-og+g8bKKGnu6b4-yTQ@mail.gmail.com
Backpatch-through: 12
Branch
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/3a58c5f1464bf5bb5e602477222da88ee201392c
Modified Files
--------------
src/backend/commands/tablecmds.c | 41 +++++++++++++++++------
src/test/regress/expected/indexing.out | 61 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/indexing.sql | 21 ++++++++++++
3 files changed, 113 insertions(+), 10 deletions(-)
^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix dependency handling of column drop with partitioned tables
@ 2019-10-13 08:54 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 5+ messages in thread
From: Michael Paquier @ 2019-10-13 08:54 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix dependency handling of column drop with partitioned tables
When dropping a column on a partitioned table which has one or more
partitioned indexes, the operation was failing as dependencies with
partitioned indexes using the column dropped were not getting removed in
a way consistent with the columns involved across all the relations part
of an inheritance tree.
This commit refactors the code executing column drop so as all the
columns from an inheritance tree to remove are gathered first, and
dropped all at the end. This way, we let the dependency machinery sort
out by itself the deletion of all the columns with the partitioned
indexes across a partition tree.
This issue has been introduced by 1d92a0c, so backpatch down to
REL_12_STABLE.
Author: Amit Langote, Michael Paquier
Reviewed-by: Álvaro Herrera, Ashutosh Sharma
Discussion: https://postgr.es/m/CA+HiwqE9kuBsZ3b5pob2-cvE8ofzPWs-og+g8bKKGnu6b4-yTQ@mail.gmail.com
Backpatch-through: 12
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/1df5875d39383b3981b804666ee1f4b0ff65943f
Modified Files
--------------
src/backend/commands/tablecmds.c | 41 +++++++++++++++++------
src/test/regress/expected/indexing.out | 61 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/indexing.sql | 21 ++++++++++++
3 files changed, 113 insertions(+), 10 deletions(-)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix dependency handling of column drop with partitioned tables
@ 2019-10-13 10:13 Michael Paquier <michael@paquier.xyz>
parent: Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 5+ messages in thread
From: Michael Paquier @ 2019-10-13 10:13 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
On Sun, Oct 13, 2019 at 08:54:19AM +0000, Michael Paquier wrote:
> Fix dependency handling of column drop with partitioned tables
>
> When dropping a column on a partitioned table which has one or more
> partitioned indexes, the operation was failing as dependencies with
> partitioned indexes using the column dropped were not getting removed in
> a way consistent with the columns involved across all the relations part
> of an inheritance tree.
>
> This commit refactors the code executing column drop so as all the
> columns from an inheritance tree to remove are gathered first, and
> dropped all at the end. This way, we let the dependency machinery sort
> out by itself the deletion of all the columns with the partitioned
> indexes across a partition tree.
rhinoceros is unhappy with this one in the sepgsql tests as this has
moved a cascading drop notice when droping a column:
ALTER TABLE regtest_table DROP COLUMN y;
LOG: SELinux: allowed { drop }
scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0
tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column
name="regtest_schema.regtest_table.y"
ALTER TABLE regtest_ptable DROP COLUMN q CASCADE;
+NOTICE: drop cascades to view regtest_pview
LOG: SELinux: allowed { drop }
scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0
tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column
name="regtest_schema.regtest_ptable_ones.q"
LOG: SELinux: allowed { drop }
scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0
tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column
name="regtest_schema.regtest_ptable_tens.q"
-NOTICE: drop cascades to view regtest_pview
It seems to me that it would be fine to just update the output to
the newly-expected behavior. Any opinions?
--
Michael
Attachments:
[application/pgp-signature] signature.asc (832B, ../../20191013101331.GC1434@paquier.xyz/2-signature.asc)
download
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix dependency handling of column drop with partitioned tables
@ 2019-10-13 20:29 Tom Lane <tgl@sss.pgh.pa.us>
parent: Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2019-10-13 20:29 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org
Michael Paquier <michael@paquier.xyz> writes:
> On Sun, Oct 13, 2019 at 08:54:19AM +0000, Michael Paquier wrote:
>> Fix dependency handling of column drop with partitioned tables
> rhinoceros is unhappy with this one in the sepgsql tests as this has
> moved a cascading drop notice when droping a column:
> ...
> It seems to me that it would be fine to just update the output to
> the newly-expected behavior. Any opinions?
Yeah, that sounds good to me.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix dependency handling of column drop with partitioned tables
@ 2019-10-14 00:00 Michael Paquier <michael@paquier.xyz>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 5+ messages in thread
From: Michael Paquier @ 2019-10-14 00:00 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org
On Sun, Oct 13, 2019 at 04:29:10PM -0400, Tom Lane wrote:
> Yeah, that sounds good to me.
Thanks, I have just committed a fix doing that.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (832B, ../../20191014000023.GB25169@paquier.xyz/2-signature.asc)
download
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2019-10-14 00:00 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-13 08:54 pgsql: Fix dependency handling of column drop with partitioned tables Michael Paquier <michael@paquier.xyz>
2019-10-13 08:54 pgsql: Fix dependency handling of column drop with partitioned tables Michael Paquier <michael@paquier.xyz>
2019-10-13 10:13 ` Michael Paquier <michael@paquier.xyz>
2019-10-13 20:29 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-10-14 00:00 ` Michael Paquier <michael@paquier.xyz>
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