]> granicus.if.org Git - postgresql/commit
Teach predtest.c about CHECK clauses to fix partitioning bugs.
authorRobert Haas <rhaas@postgresql.org>
Wed, 14 Jun 2017 17:13:11 +0000 (13:13 -0400)
committerRobert Haas <rhaas@postgresql.org>
Wed, 14 Jun 2017 17:13:11 +0000 (13:13 -0400)
commitb08df9cab777427fdafe633ca7b8abf29817aa55
tree8875d2b014796a7359bcae4778226277bfd11d95
parenta12c09ad86e60a8acb269744b8ee86429dda2cd8
Teach predtest.c about CHECK clauses to fix partitioning bugs.

In a CHECK clause, a null result means true, whereas in a WHERE clause
it means false.  predtest.c provided different functions depending on
which set of semantics applied to the predicate being proved, but had
no option to control what a null meant in the clauses provided as
axioms.  Add one.

Use that in the partitioning code when figuring out whether the
validation scan on a new partition can be skipped.  Rip out the
old logic that attempted (not very successfully) to compensate
for the absence of the necessary support in predtest.c.

Ashutosh Bapat and Robert Haas, reviewed by Amit Langote and
incorporating feedback from Tom Lane.

Discussion: http://postgr.es/m/CAFjFpReT_kq_uwU_B8aWDxR7jNGE=P0iELycdq5oupi=xSQTOw@mail.gmail.com
src/backend/commands/tablecmds.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/predtest.c
src/backend/utils/adt/selfuncs.c
src/include/optimizer/predtest.h
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql