diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-01-18 14:49:40 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-01-18 15:00:45 -0300 |
commit | 0325d7a5957ba39a0dce90835ab54a08ab8bf762 (patch) | |
tree | 864a2879bd225c033d1c534ee42dd6cdace298bc /src/backend/commands/functioncmds.c | |
parent | 03afae201f0a0762bb66cf02e038ed0d982ad048 (diff) | |
download | postgresql-0325d7a5957ba39a0dce90835ab54a08ab8bf762.tar.gz postgresql-0325d7a5957ba39a0dce90835ab54a08ab8bf762.zip |
Fix creation of duplicate foreign keys on partitions
When creating a foreign key in a partitioned table, if some partitions
already have equivalent constraints, we wastefully create duplicates of
the constraints instead of attaching to the existing ones. That's
inconsistent with the de-duplication that is applied when a table is
attached as a partition. To fix, reuse the FK-cloning code instead of
having a separate code path.
Backpatch to Postgres 11. This is a subtle behavior change, but surely
a welcome one since there's no use in having duplicate foreign keys.
Discovered by Álvaro Herrera while thinking about a different problem
reported by Jesper Pedersen (bug #15587).
Author: Álvaro Herrera
Discussion: https://postgr.es/m/201901151935.zfadrzvyof4k@alvherre.pgsql
Diffstat (limited to 'src/backend/commands/functioncmds.c')
0 files changed, 0 insertions, 0 deletions