Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Bug] INCLUDE (non-key) index column referenced by a predicate is treated as valid

Đang mở
#2,126 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
32/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c, postgresql
Lĩnh vực
databases

Hướng nghiên cứu

The bug is in GPORCA's construction of index conditions, and the issue suspects CXformUtils::PdrgpcrIndexColumns, which merges key and INCLUDE columns into one array. Reproduce the two SELECT statements with optimizer on and compare against optimizer off, then check which Index Cond the plan builds and where nodeIndexscan.c rejects it. Done means both queries return rows under optimizer=on without either sanity-check error. The issue reports an unmerged local fix but does not name a target design, so confirm the expected behaviour with maintainers first.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

type: Bug
Apache Cloudberry version

No response

What happened

A GPORCA bug: an INCLUDE (non-key) index column referenced by a predicate is treated as a valid
index key column when building an Index Cond (likely via CXformUtils::PdrgpcrIndexColumns, which
concatenates key and included columns into one array with no marker distinguishing the two). The
resulting plan carries a scan key against an attribute beyond indnkeyatts, which the executor
rejects. Which sanity check fires depends on the predicate, so one bug produces two error
messages -- both are suppressed below:

CREATE TABLE t(a int, b ); CREATE INDEX i ON t USING btree (a) INCLUDE (b);
SET optimizer = on;
SELECT a FROM t WHERE b; -- b boolean: "bogus index qualification (nodeIndexscan.c)"
SELECT a FROM t WHERE b IS NULL; -- b int: "btree index keys must be ordered by attribute"

Verified scope: optimizer=on only (the Postgres planner never builds such an Index Cond, and
every case above returns the correct rows under optimizer=off); not specific to a distribution
policy (DISTRIBUTED BY and DISTRIBUTED REPLICATED both reproduce); needs no data, an empty table
is enough; and the INCLUDE list does not have to overlap the key columns -- a plain
"INCLUDE (b)" is sufficient. A fix exists locally but has not been merged into the Cloudberry
main branch this environment is built from.

What you think should happen instead

No response

How to reproduce
CREATE TABLE t(a int, b int); CREATE INDEX i ON t USING btree (a) INCLUDE (b);
SET optimizer = on;
SELECT a FROM t WHERE b IS NULL; -- b int: "btree index keys must be ordered by attribute"
Operating System

any

Anything else

No response

Are you willing to submit PR?
  • Yes, I am willing to submit a PR!
Code of Conduct
Ngôn ngữ chính
C
Star
1.4k
Fork
260
Merge trung bình
4 ngày 19 giờ
Pull request đã merge (30 ngày)
54

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/cloudberry

Tất cả issue của apache/cloudberry

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.