Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#2,126 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
32/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
c, postgresql
Área
databases

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
C
Estrellas
1.4k
Forks
260
Merge medio
4 d 13 h
PR fusionados (30 d)
56

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/cloudberry

Todos los issues de apache/cloudberry

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.