]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix bogus logic for reporting which hash partition conflicts.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Jun 2021 18:34:31 +0000 (14:34 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Jun 2021 18:34:41 +0000 (14:34 -0400)
commitf8b51464c265696c1eab1c896bddc797beb9a13c
treee67ca8b13b08f500f499544beb821ac75353b982
parentcaa0f07d2d4b69cd53b5bf7c847d9d65eadbbfee
Fix bogus logic for reporting which hash partition conflicts.

Commit efbfb6424 added logic for reporting exactly which existing
partition conflicts when complaining that a new hash partition's
modulus isn't compatible with the existing ones.  However, it
misunderstood the partitioning data structure, and would select
the wrong partition in some cases, or crash outright due to fetching
a bogus table OID in other cases.

Per bug #17076 from Alexander Lakhin.  Fix by Amit Langote;
some further work on the code comments by me.

Discussion: https://postgr.es/m/17076-89a16ae835d329b9@postgresql.org
src/backend/partitioning/partbounds.c
src/test/regress/expected/create_table.out
src/test/regress/sql/create_table.sql