yugabyte/yugabyte-db

[YSQL] Indexes created on Numeric type are inconsistent

Open

#28 967 ouverte le 16 oct. 2025

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)C (1 003 forks)batch import
area/ysqlgood first issuekind/bugpriority/low

Métriques du dépôt

Stars
 (8 229 stars)
Métriques de merge PR
 (Merge moyen 17j 21h) (92 PRs mergées en 30 j)

Description

Jira Link: DB-18707

Description

Version - 2.29.0.0-b43 Steps -

CREATE TABLE test (id SERIAL PRIMARY KEY, c_numeric NUMERIC(12,4));
INSERT INTO test (c_numeric) SELECT (random()*1000)::numeric(12,4) FROM generate_series(1, 10000);
CREATE INDEX test_idx ON test ((c_numeric*2)) ;
select yb_index_check('test_idx'::regclass);

Error -

ERROR:  inconsistent index row due to binary mismatch of key attribute
DETAIL:  index: 'test_idx', ybbasectid: '\x4700b3488000059b2121', index attnum: 1

However, If we do not use expression the index is found consistent -

CREATE TABLE test (id SERIAL PRIMARY KEY, c_numeric NUMERIC(12,4));
INSERT INTO test (c_numeric) SELECT (random()*1000)::numeric(12,4) FROM generate_series(1, 10000);
CREATE INDEX test_idx ON test (c_numeric) ;
select yb_index_check('test_idx'::regclass);

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.

Guide contributeur