From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #18256: spgGetCache() attempts to read to read invalid file for index attached to partitioned table
Date: Thu, 21 Dec 2023 14:00:01 +0000
Message-ID: <18256-0b0e1b6e4a620f1b@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 18256
Logged by: Alexander Lakhin
Email address: exclusion@gmail.com
PostgreSQL version: 16.1
Operating system: Ubuntu 22.04
Description:
[ a kind of follow-up to bug #18246 ]
The following query:
CREATE TABLE t(a int, b text) PARTITION BY RANGE (a);
CREATE INDEX idx ON t USING spgist(b);
SELECT * FROM t;
produces an unexpected error:
ERROR: could not open file "pg_tblspc/0/PG_16_202307071/0/0": No such file
or directory
(On master, thanks to commit 049ef3398, which added an Assert in smgr.c,
that assertion fails:
...
#5 0x000055fcb19630d3 in ExceptionalCondition (conditionName=0x55fcb1b573f8
"RelFileNumberIsValid(rlocator.relNumber)", fileName=0x55fcb1b573ec
"smgr.c", lineNumber=159) at assert.c:66
#6 0x000055fcb1770731 in smgropen (rlocator=..., backend=-1) at
smgr.c:159
#7 0x000055fcb171e0a7 in RelationGetSmgr (rel=0x7ff29e501e88) at
../../../../src/include/utils/rel.h:575
#8 0x000055fcb171f0ed in ReadBufferExtended (reln=0x7ff29e501e88,
forkNum=MAIN_FORKNUM, blockNum=0, mode=RBM_NORMAL, strategy=0x0) at
bufmgr.c:803
#9 0x000055fcb171efce in ReadBuffer (reln=0x7ff29e501e88, blockNum=0) at
bufmgr.c:737
#10 0x000055fcb1294810 in spgGetCache (index=0x7ff29e501e88) at
spgutils.c:261
#11 0x000055fcb1291aff in spgcanreturn (index=0x7ff29e501e88, attno=1) at
spgscan.c:1092
#12 0x000055fcb125a3ef in index_can_return (indexRelation=0x7ff29e501e88,
attno=1) at indexam.c:762
#13 0x000055fcb166154b in get_relation_info (root=0x55fcb27dd928,
relationObjectId=16385, inhparent=false, rel=0x55fcb2700938) at
plancat.c:272
#14 0x000055fcb166956e in build_simple_rel (root=0x55fcb27dd928, relid=1,
parent=0x0) at relnode.c:339
...
)
Reproduced on REL_16_STABLE (starting from 3c569049b) .. master.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, exclusion@gmail.com
Subject: Re: BUG #18256: spgGetCache() attempts to read to read invalid file for index attached to partitioned table
In-Reply-To: <18256-0b0e1b6e4a620f1b@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox