On 10/24/24 22:30, jian he wrote:
hi. I think I found a bug.
PostgreSQL 18devel_debug_build_45188c2ea2 on x86_64-linux, compiled by
gcc-14.1.0, 64-bit
commit at 45188c2ea2.
Ubuntu 22.04.4 LTS
setup:
drop table t cascade;
create table t(a int PRIMARY key);
IN session1:
step "change data type" {begin; alter table t alter column a set data
type int4;}
step "s1" {commit;}
IN session2:
step "psql_another_session" {\d t}
permutation "change data type" "psql_another_session" "s1"
ERROR: cache lookup failed for attribute 1 of relation 34418
Yes, it looks like a bug existing for a long time, at least since PG11
(I didn't trace further down).
It seems that the backend didn't apply invalidation messages before
touching system caches. Backtrace:
in get_attoptions (relid=16388, attnum=1) at lsyscache.c:982
in pg_get_indexdef_worker (indexrelid=16388, colno=0, excludeOps=0x0,
attrsOnly=false, keysOnly=false, showTblSpc=false, inherits=false,
prettyFlags=7, missing_ok=true) at ruleutils.c:1458
in pg_get_indexdef_ext (fcinfo=0x55a15acc1c18) at ruleutils.c:1202
in ExecInterpExpr (state=0x55a15acc2a10, econtext=0x55a15ac62930,
isnull=0x7fffd66a5bcf) at execExprInterp.c:770
in ExecInterpExprStillValid (state=0x55a15acc2a10,
econtext=0x55a15ac62930, isNull=0x7fffd66a5bcf) at execExprInterp.c:2035
in ExecEvalExprSwitchContext (state=0x55a15acc2a10,
econtext=0x55a15ac62930, isNull=0x7fffd66a5bcf) at
../../../src/include/executor/executor.h:367
in ExecProject (projInfo=0x55a15acc2a08) at
../../../src/include/executor/executor.h:401
--
regards, Andrei Lepikhov