Re: A bug in mapping attributes in ATExecAttachPartition()
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, pgsql-hackers <pgsql-hackers@postgresql.org>,
Amit Langote <amitlangote09@gmail.com>
Date: 2017-06-13T20:36:07Z
Lists: pgsql-hackers
Attachments
- extend-predicate-implied-by-v1.patch (application/octet-stream) patch v1
On Tue, Jun 13, 2017 at 10:24 AM, Robert Haas <robertmhaas@gmail.com> wrote: > I think that's going to come as an unpleasant surprise to more than > one user. I'm not sure exactly how we need to restructure things here > so that this works properly, and maybe modifying > predicate_implied_by() isn't the right thing at all; for instance, > there's also predicate_refuted_by(), which maybe could be used in some > way (inject NOT?). But I don't much like the idea that you copy and > paste the partitioning constraint into a CHECK constraint and that > doesn't work. That's not cool. OK, I think I see the problem here. predicate_implied_by() and predicate_refuted_by() differ in what they assume about the predicate evaluating to NULL, but both of them assume that if the clause evaluates to NULL, that's equivalent to false. So there's actually no option to get the behavior we want here, which is to treat both operands using CHECK-semantics (null is true) rather than WHERE-semantics (null is false). Given that, Ashutosh's proposal of passing an additional flag to predicate_implied_by() seems like the best option. Here's a patch implementing that. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Fix inconsistent capitalization.
- 29f021160ea7 10.0 landed
- 42651bdd68a1 11.0 landed
-
Fix bug in deciding whether to scan newly-attached partition.
- f85f88bcc270 10.0 landed
-
Fix lock upgrade hazard in ATExecAttachPartition.
- 972b6ec20bf0 10.0 landed
-
Code beautification for ATExecAttachPartition.
- 583df3b5c562 10.0 landed
-
Teach predtest.c about CHECK clauses to fix partitioning bugs.
- b08df9cab777 10.0 landed
-
Don't explicitly mark range partitioning columns NOT NULL.
- 3ec76ff1f2cf 10.0 cited