CREATE TABLE vaccluster (i INT PRIMARY KEY);
ALTER TABLE vaccluster CLUSTER ON vaccluster_pkey;
CLUSTER vaccluster;
CREATE FUNCTION do_analyze() RETURNS VOID VOLATILE LANGUAGE SQL
AS 'ANALYZE pg_am';
CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
AS 'SELECT $1 FROM do_analyze()';
CREATE INDEX ON vaccluster(wrap_do_analyze(i));
INSERT INTO vaccluster VALUES (1), (2);
Backtrace:
* frame #0: 0x000000010e5ffd6b postgres`GetActiveSnapshot + 11 at snapmgr.c:759
frame #1: 0x000000010e2731da postgres`postquel_start(es=0x00007f9ceb810de0, fcache=0x00007f9ceb80e430) + 170 at functions.c:800
frame #2: 0x000000010e272517 postgres`fmgr_sql(fcinfo=0x00007f9cea870bd0) + 839 at functions.c:1145
frame #3: 0x000000010e26e78a postgres`ExecMakeFunctionResultNoSets(fcache=0x00007f9cea870b60, econtext=0x00007f9cea870940, isNull="", isDone=0x0000000000000000) + 346 at execQual.c:2041
frame #4: 0x000000010e268a17 postgres`ExecEvalFunc(fcache=0x00007f9cea870b60, econtext=0x00007f9cea870940, isNull="", isDone=0x0000000000000000) + 199 at execQual.c:2432
frame #5: 0x000000010e2648e3 postgres`ExecEvalExprSwitchContext(expression=0x00007f9cea870b60, econtext=0x00007f9cea870940, isNull="", isDone=0x0000000000000000) + 67 at execQual.c:4413
frame #6: 0x000000010e111b30 postgres`FormIndexDatum(indexInfo=0x00007f9cea863b50, slot=0x00007f9cea8637e0, estate=0x00007f9cea870830, values=0x00007fff51bc7ac0, isnull="") + 320 at index.c:1789
frame #7: 0x000000010e25aada postgres`ExecInsertIndexTuples(slot=0x00007f9cea8637e0, tupleid=0x00007f9cea863684, estate=0x00007f9cea870830, noDupErr='\0', specConflict=0x0000000000000000, arbiterIndexes=0x0000000000000000) + 602 at execIndexing.c:355
frame #8: 0x000000010ec14bfb multimaster.so`UserTableUpdateOpenIndexes(estate=0x00007f9cea870830, slot=0x00007f9cea8637e0) + 123 at pglogical_apply.c:298
frame #9: 0x000000010ec135a8 multimaster.so`process_remote_insert(s=0x00007fff51bcbe40, rel=0x000000010ea38330) + 904 at pglogical_apply.c:739
frame #10: 0x000000010ec12b65 multimaster.so`MtmExecutor(id=0, work=0x00007f9cea40b980, size=142) + 693 at pglogical_apply.c:997
frame #11: 0x000000010ec0e86d multimaster.so`BgwPoolMainLoop(arg=140311923791792) + 589 at bgwpool.c:57
frame #12: 0x000000010e37330a postgres`StartBackgroundWorker + 826 at bgworker.c:726
frame #13: 0x000000010e388ab0 postgres`do_start_bgworker(rw=0x00007f9cea601e90) + 240 at postmaster.c:5531
frame #14: 0x000000010e383d1b postgres`maybe_start_bgworker + 427 at postmaster.c:5706
frame #15: 0x000000010e38424e postgres`ServerLoop + 1198 at postmaster.c:1762
frame #16: 0x000000010e381ca9 postgres`PostmasterMain(argc=3, argv=0x00007f9cea403900) + 5897 at postmaster.c:1298
frame #17: 0x000000010e2bb60f postgres`main(argc=3, argv=0x00007f9cea403900) + 751 at main.c:228
frame #18: 0x00007fff8b9b15ad libdyld.dylib`start + 1
Backtrace: