Re: ALTER TABLE SET ACCESS METHOD on partitioned tables

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Soumyadeep Chakraborty <soumyadeep2007(at)gmail(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>, pgsql-hackers(at)postgresql(dot)org, Ashwin Agrawal <ashwinstar(at)gmail(dot)com>, vanjared(at)vmware(dot)com
Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Date: 2024-03-26 08:00:00
Message-ID: e5516ac1-5264-c3c0-d822-9e6f614ea93b@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Alvaro,

21.03.2024 15:07, Alvaro Herrera wrote:
> Given that Michaël is temporarily gone, I propose to push the attached
> tomorrow.

Please look at a new anomaly introduced with 374c7a229.
Starting from that commit, the following erroneous query:
CREATE FOREIGN TABLE fp PARTITION OF pg_am DEFAULT SERVER x;

triggers an assertion failure:
TRAP: failed Assert("relation->rd_rel->relam == InvalidOid"), File: "relcache.c", Line: 1219, PID: 3706301

with the stack trace:
...
#4  0x00007fe53ced67f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x000055f28555951e in ExceptionalCondition (conditionName=conditionName(at)entry=0x55f285744788
"relation->rd_rel->relam == InvalidOid", fileName=fileName(at)entry=0x55f285743f1c "relcache.c",
lineNumber=lineNumber(at)entry=1219)
    at assert.c:66
#6  0x000055f285550450 in RelationBuildDesc (targetRelId=targetRelId(at)entry=16385, insertIt=insertIt(at)entry=false) at
relcache.c:1219
#7  0x000055f285550769 in RelationClearRelation (relation=relation(at)entry=0x7fe5310dd178, rebuild=rebuild(at)entry=true) at
relcache.c:2667
#8  0x000055f285550c41 in RelationFlushRelation (relation=0x7fe5310dd178) at relcache.c:2850
#9  0x000055f285550ca0 in RelationCacheInvalidateEntry (relationId=<optimized out>) at relcache.c:2921
#10 0x000055f285542551 in LocalExecuteInvalidationMessage (msg=0x55f2861b3160) at inval.c:738
#11 0x000055f28554159b in ProcessInvalidationMessages (group=0x55f2861b2e6c, func=func(at)entry=0x55f2855424a8
<LocalExecuteInvalidationMessage>) at inval.c:518
#12 0x000055f285542740 in CommandEndInvalidationMessages () at inval.c:1180
#13 0x000055f28509cbbd in AtCCI_LocalCache () at xact.c:1550
#14 0x000055f28509e88e in CommandCounterIncrement () at xact.c:1116
#15 0x000055f2851d0c8b in DefineRelation (stmt=stmt(at)entry=0x55f2861803b0, relkind=relkind(at)entry=102 'f', ownerId=10,
ownerId(at)entry=0, typaddress=typaddress(at)entry=0x0,
    queryString=queryString(at)entry=0x55f28617f870 "CREATE FOREIGN TABLE fp PARTITION OF pg_am DEFAULT SERVER x;") at
tablecmds.c:1008
#16 0x000055f28540945d in ProcessUtilitySlow (pstate=pstate(at)entry=0x55f2861a9dc0, pstmt=pstmt(at)entry=0x55f286180510,
queryString=queryString(at)entry=0x55f28617f870 "CREATE FOREIGN TABLE fp PARTITION OF pg_am DEFAULT SERVER x;",
    context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0, queryEnv=queryEnv(at)entry=0x0,
dest=0x55f2861807d0, qc=0x7fff15b5d7c0) at utility.c:1203
#17 0x000055f28540911f in standard_ProcessUtility (pstmt=0x55f286180510, queryString=0x55f28617f870 "CREATE FOREIGN
TABLE fp PARTITION OF pg_am DEFAULT SERVER x;", readOnlyTree=<optimized out>, context=PROCESS_UTILITY_TOPLEVEL,
    params=0x0, queryEnv=0x0, dest=0x55f2861807d0, qc=0x7fff15b5d7c0) at utility.c:1067
...

On 374c7a229~1 it fails with
ERROR:  "pg_am" is not partitioned

Best regards,
Alexander

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tharakan, Robins 2024-03-26 08:03:36 RE: Why is parula failing?
Previous Message Andres Freund 2024-03-26 07:59:12 Re: Recent 027_streaming_regress.pl hangs