Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xRYdu-000000014un-0T2p for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Nov 2026 17:31:22 +0000 Received: from localhost ([127.0.0.1]:47716 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xRYds-0000000450q-0scf for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Nov 2026 17:31:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:46554) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xR9vi-0000000BiH6-19Mq for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 15:08:06 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xR9vh-00000000OJg-1xuD for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 15:08:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=i1OfeJP8Cp7psgbnlzIkQrsd2C3g+HNqqa4ja69Eamw=; b=oDKz92utN81SWYjpsljZIrePYv MGtnFjfQ+LWAwskvnuvHpmnirbJm8s849TuEG6B/XEFkGFKcA918yeqAoxmsbYzmBpZJLJ3Uke24O 6VrYfOGSMvsR4i2ganYp1ei4AZOTjW7A/b2SgyYbZPTFIYXdHdYCTuNLrRODOl69dKqZa4IX0S8uX 2b5cJeR+ASCeJ1+olhffoeoYcfYkQaU1hBleFVzE2OHd6tbxWbne48QfNSkzEQOABlNanDXd7/AAy L3+c8q0kPvxiF8h1agHm7oegrPor5nm3so+rfBoOjw48tjy0JhDYyUPUcgnP2zja2PSUmLGJ3SGsW 1ttKpAhw==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xR9vg-000000014il-2GCg for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 15:08:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xR9vf-00000002m0g-2Dtn for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 15:08:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19887: cube expression index returns wrong rows after extra_float_digits change To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: idrissaajalloh@gmail.com Reply-To: idrissaajalloh@gmail.com, pgsql-bugs@lists.postgresql.org Date: Wed, 11 Nov 2026 15:07:37 +0000 Message-ID: <19887-b2be0d8951d8498b@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19887 Logged by: Wren Email address: idrissaajalloh@gmail.com PostgreSQL version: 18.6 Operating system: Linux/amd64 Description: =20 A cube expression index built with extra_float_digits =3D 0 returns no rows after the setting is changed to 3, while sequential evaluation of the same predicate returns one row. cube_out(cube) is marked IMMUTABLE, but the same cube value is rendered as (1.23456789012346) with the first setting and (1.2345678901234567) with the second. An IMMUTABLE output function must produce the same result for the same input. Changing a session setting therefore should not make indexed and sequential evaluation of the same expression disagree. How to repeat: \set ON_ERROR_STOP on DROP TABLE IF EXISTS points; DROP EXTENSION IF EXISTS cube; CREATE EXTENSION cube; SELECT p.provolatile AS cube_out_volatility FROM pg_proc AS p WHERE p.oid =3D 'cube_out(cube)'::regprocedure; SET extra_float_digits =3D 0; CREATE TABLE points(c cube); INSERT INTO points VALUES ('(1.2345678901234567)'::cube); SELECT c::text AS output_at_zero FROM points; CREATE INDEX points_text_idx ON points ((c::text)); SET extra_float_digits =3D 3; SELECT c::text AS output_at_three FROM points; SET enable_seqscan =3D on; SET enable_indexscan =3D off; SET enable_bitmapscan =3D off; SELECT count(*) AS seq_count FROM points WHERE c::text =3D '(1.2345678901234567)'; SET enable_indexscan =3D on; SET enable_bitmapscan =3D on; SET enable_seqscan =3D off; SELECT count(*) AS index_count FROM points WHERE c::text =3D '(1.2345678901234567)'; EXPLAIN (COSTS OFF) SELECT count(*) FROM points WHERE c::text =3D '(1.2345678901234567)'; RESET enable_seqscan; RESET enable_indexscan; RESET enable_bitmapscan; RESET extra_float_digits; DROP TABLE points; DROP EXTENSION cube; The relevant output was: cube_out_volatility --------------------- i (1 row) output_at_zero -------------------- (1.23456789012346) (1 row) output_at_three ---------------------- (1.2345678901234567) (1 row) seq_count ----------- 1 (1 row) index_count ------------- 0 (1 row) QUERY PLAN ------------------------------------------------------------ Aggregate -> Index Scan using points_text_idx on points Index Cond: ((c)::text =3D '(1.2345678901234567)'::text) (3 rows) The issue was reproduced on PostgreSQL 18.6 on Linux/amd64 with the cube extension and the session-local settings shown above. The IMMUTABLE declaration permits c::text in the expression index even though its result changes with extra_float_digits, leaving the index with text generated under the earlier setting. This occurs when cube text output is stored in an expression index and extra_float_digits changes before the indexed expression is queried.