Don't add a redundant constraint when detaching a partition
Alvaro Herrera <alvherre@alvh.no-ip.org>
Don't add a redundant constraint when detaching a partition On ALTER TABLE .. DETACH CONCURRENTLY, we add a new table constraint that duplicates the partition constraint. But if the partition already has another constraint that implies that one, then that's unnecessary. We were already avoiding the addition of a duplicate constraint if there was an exact 'equal' match -- this just improves the quality of the check. Author: Justin Pryzby <pryzby@telsasoft.com> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/20210410184226.GY6592@telsasoft.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/tablecmds.c | modified | +28 −33 |
| src/test/regress/expected/alter_table.out | modified | +20 −0 |
| src/test/regress/sql/alter_table.sql | modified | +6 −0 |
Discussion
- ALTER TABLE .. DETACH PARTITION CONCURRENTLY 89 messages · 2020-08-03 → 2021-05-25