From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Christophe Pettus <xof(at)thebuild(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: = TRUE vs IS TRUE confuses partition index creation |
Date: | 2022-08-17 04:27:30 |
Message-ID: | CAMbWs49SVPtFGy4+55eTLR++XPAhhH2VPcUdqvC08Dr4-amRQg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Wed, Aug 17, 2022 at 5:57 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> IIRC, "b = true" will be simplified to just "b" somewhere in expression
> preprocessing. I'm betting that something in the partitioned index
> matching code is applying that preprocessing to one index predicate and
> not the other, whereupon they look different. If that's the explanation,
> there are likely other cases that should match and fail to.
Yeah, you're right. The matching work happens in indexcmds.c, using
CompareIndexInfo to compare 'cldIdxInfo' and 'indexInfo'. The
'cldIdxInfo' is constructed with BuildIndexInfo, which would run index
expressions and index predicates through const-simplification before
creating the IndexInfo node. While 'indexInfo' is created without any
const-simplification.
This can be verified with the attached changes, which would make it work
for this case.
Thanks
Richard
Attachment | Content-Type | Size |
---|---|---|
v1-0001-fix-partitioned-index-matching.patch | application/octet-stream | 1.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2022-08-17 04:40:52 | Re: No-op updates with partitioning and logical replication started failing in version 13 |
Previous Message | Andres Freund | 2022-08-17 01:18:19 | Re: BUG #17586: Look like there are an another bug in REINDEX INDEX CONCURRENTLY of pg_toast indexes |