Re: cache lookup failed when \d t concurrent with DML change column data type - Mailing list pgsql-hackers

From Andrei Lepikhov
Subject Re: cache lookup failed when \d t concurrent with DML change column data type
Date
Msg-id 00e2c23e-f62c-4890-923b-aab8e0cc0d84@gmail.com
Whole thread Raw
In response to cache lookup failed when \d t concurrent with DML change column data type  (jian he <jian.universality@gmail.com>)
Responses Re: cache lookup failed when \d t concurrent with DML change column data type
List pgsql-hackers
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




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Docs Build in CI failing with "failed to load external entity"
Next
From: wenhui qiu
Date:
Subject: Re: POC: make mxidoff 64 bits