PANIC in heap_delete during ALTER TABLE

From: Robins Tharakan <tharakan(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: PANIC in heap_delete during ALTER TABLE
Date: 2022-08-22 04:02:48
Message-ID: CAEP4nAw9jYQDKd_5Y+-s2E4YiUJq1vqiikFjYGpLShtp-K3gag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

During ALTER TABLE, heap_delete() can PANIC with the error
"PANIC: wrong buffer passed to visibilitymap_clear".

Given below are backtraces on master, REL_15_STABLE and REL_13_STABLE.
There was a similar discussion last year [1], although that was about
heap_update() and was soon fixed [2]; thus reporting this as a separate
thread.

Here are 4 concurrent PANICs running ALTER TABLE on separate tables
(on 1509abe2c5(at)master):

=== Error Log (Shows all 4 PIDs above) ===
2022-08-20 12:37:53.937 UTC [3739799] PANIC: wrong buffer passed to
visibilitymap_clear
2022-08-20 12:37:53.937 UTC [3739799] STATEMENT: ALTER TABLE ONLY sch12.bool
ALTER COLUMN b SET DATA TYPE TEXT USING
public.postgres_fdw_disconnect_all()
2022-08-20 12:37:53.937 UTC [3737759] PANIC: wrong buffer passed to
visibilitymap_clear
2022-08-20 12:37:53.937 UTC [3737759] STATEMENT: ALTER TABLE ONLY sch13.bool
ALTER COLUMN b SET DATA TYPE TEXT USING pg_catalog.pg_rotate_logfile_old()
2022-08-20 12:37:53.941 UTC [3740312] PANIC: wrong buffer passed to
visibilitymap_clear
2022-08-20 12:37:53.941 UTC [3740312] STATEMENT: ALTER TABLE ONLY sch2.flot
ALTER COLUMN f SET DATA TYPE TEXT USING pg_catalog.ceiling(
cast(sch2.flot.f as float8))
2022-08-20 12:37:53.945 UTC [3737305] PANIC: wrong buffer passed to
visibilitymap_clear
2022-08-20 12:37:53.945 UTC [3737305] STATEMENT: ALTER TABLE ONLY sch27.chr
ALTER COLUMN c SET DATA TYPE TEXT USING sch27.chr.c

=== Backtrace - PID 3737759 - 1509abe2c5(at)master ===
#3 0x0000556a0e4a669f in visibilitymap_clear (rel=0x7fcec5fba700,
heapBlk=10, buf=0, flags=3 '\003') at visibilitymap.c:156
#4 0x0000556a0e48401a in heap_delete (relation=0x7fcec5fba700,
tid=0x7fcec5d50f3c, cid=1, crosscheck=0x0, wait=true,
tmfd=0x7ffe1987e530, changingPart=false) at heapam.c:2931
#5 0x0000556a0e484567 in simple_heap_delete (relation=0x7fcec5fba700,
tid=0x7fcec5d50f3c) at heapam.c:3078
#6 0x0000556a0e55d566 in CatalogTupleDelete (heapRel=0x7fcec5fba700,
tid=0x7fcec5d50f3c) at indexing.c:352
#7 0x0000556a0e559bc7 in index_drop (indexId=20788, concurrent=false,
concurrent_lock_mode=false) at index.c:2349
#8 0x0000556a0e54bb3e in doDeletion (object=0x556a120d32b0, flags=1)
at dependency.c:1408
#9 0x0000556a0e54b88b in deleteOneObject (object=0x556a120d32b0,
depRel=0x7ffe1987e7e0, flags=1) at dependency.c:1317
#10 0x0000556a0e549ff1 in deleteObjectsInList (targetObjects=0x556a0fd884e0,
depRel=0x7ffe1987e7e0, flags=1) at dependency.c:278
#11 0x0000556a0e54a1fe in performMultipleDeletions (objects=0x556a0fed5688,
behavior=DROP_RESTRICT, flags=1) at dependency.c:439
#12 0x0000556a0e6a0d4d in ATPostAlterTypeCleanup (wqueue=0x7ffe1987e9a8,
tab=0x556a11fcc8f8, lockmode=8) at tablecmds.c:13196
#13 0x0000556a0e68dbc6 in ATRewriteCatalogs (wqueue=0x7ffe1987e9a8,
lockmode=8, context=0x7ffe1987eba0) at tablecmds.c:4888
#14 0x0000556a0e68cda1 in ATController (parsetree=0x556a0f945e88,
rel=0x7fcec5ef9e70, cmds=0x556a0f945e50, recurse=false, lockmode=8,
context=0x7ffe1987eba0) at tablecmds.c:4455
#15 0x0000556a0e68c9b6 in AlterTable (stmt=0x556a0f945e88, lockmode=8,
context=0x7ffe1987eba0) at tablecmds.c:4101
#16 0x0000556a0e995140 in ProcessUtilitySlow (pstate=0x556a11fcc7e0,
pstmt=0x556a0f946198,
queryString=0x556a0f944fb0 "ALTER TABLE ONLY sch13.bool\n ALTER
COLUMN b SET DATA TYPE TEXT USING
pg_catalog.pg_rotate_logfile_old()",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x556a0f946268, qc=0x7ffe1987f4e0) at utility.c:1325

=== Backtrace FULL - PID 3737759 - 1509abe2c5(at)master ===
#2 0x0000556a0eb5246d in errfinish (
filename=0x556a0ebeb0a8 "visibilitymap.c", lineno=156,
funcname=0x556a0ebeb250 <__func__.12780> "visibilitymap_clear")
at elog.c:675
edata = 0x556a0eeed2c0 <errordata>
elevel = 23
oldcontext = 0x556a11fcc6c0
econtext = 0x0
__func__ = "errfinish"
#3 0x0000556a0e4a669f in visibilitymap_clear (rel=0x7fcec5fba700,
heapBlk=10, buf=0, flags=3 '\003') at visibilitymap.c:156
__errno_location = <optimized out>
mapBlock = 0
mapByte = 2
mapOffset = 4
mask = 48 '0'
map = 0x7fcec71f4680 "\177\006"
cleared = false
__func__ = "visibilitymap_clear"
#4 0x0000556a0e48401a in heap_delete (relation=0x7fcec5fba700,
tid=0x7fcec5d50f3c, cid=1, crosscheck=0x0, wait=true,
tmfd=0x7ffe1987e530, changingPart=false) at heapam.c:2931
result = TM_Ok
xid = 84612
lp = 0x7fcecb11f1dc
tp = {t_len = 166, t_self = {ip_blkid = {bi_hi = 0, bi_lo = 10},
ip_posid = 18}, t_tableOid = 2610, t_data = 0x7fcecb1202a0}
page = 0x7fcecb11f180 "\036"
block = 10
buffer = 8021
vmbuffer = 0
new_xmax = 84612
new_infomask = 0
new_infomask2 = 8192
have_tuple_lock = true
iscombo = false
all_visible_cleared = true
old_key_tuple = 0x0
old_key_copied = false
__func__ = "heap_delete"

=== Backtrace - PID 3740312 - 1509abe2c5(at)master ===
#3 0x0000556a0e4a669f in visibilitymap_clear (rel=0x7fcec5d9eda8, heapBlk=6,
buf=0, flags=3 '\003') at visibilitymap.c:156
#4 0x0000556a0e48401a in heap_delete (relation=0x7fcec5d9eda8,
tid=0x7fcec5da102c, cid=1, crosscheck=0x0, wait=true,
tmfd=0x7ffe1987e530, changingPart=false) at heapam.c:2931
#5 0x0000556a0e484567 in simple_heap_delete (relation=0x7fcec5d9eda8,
tid=0x7fcec5da102c) at heapam.c:3078
#6 0x0000556a0e55d566 in CatalogTupleDelete (heapRel=0x7fcec5d9eda8,
tid=0x7fcec5da102c) at indexing.c:352
#7 0x0000556a0e559bc7 in index_drop (indexId=20606, concurrent=false,
concurrent_lock_mode=false) at index.c:2349
#8 0x0000556a0e54bb3e in doDeletion (object=0x556a108fadf0, flags=1)
at dependency.c:1408
#9 0x0000556a0e54b88b in deleteOneObject (object=0x556a108fadf0,
depRel=0x7ffe1987e7e0, flags=1) at dependency.c:1317
#10 0x0000556a0e549ff1 in deleteObjectsInList (targetObjects=0x556a121823d0,
depRel=0x7ffe1987e7e0, flags=1) at dependency.c:278
#11 0x0000556a0e54a1fe in performMultipleDeletions (objects=0x556a108f9058,
behavior=DROP_RESTRICT, flags=1) at dependency.c:439
#12 0x0000556a0e6a0d4d in ATPostAlterTypeCleanup (wqueue=0x7ffe1987e9a8,
tab=0x556a1022c128, lockmode=8) at tablecmds.c:13196
#13 0x0000556a0e68dbc6 in ATRewriteCatalogs (wqueue=0x7ffe1987e9a8,
lockmode=8, context=0x7ffe1987eba0) at tablecmds.c:4888
#14 0x0000556a0e68cda1 in ATController (parsetree=0x556a0f946138,
rel=0x556a0fe345f0, cmds=0x556a0f946100, recurse=false, lockmode=8,
context=0x7ffe1987eba0) at tablecmds.c:4455
#15 0x0000556a0e68c9b6 in AlterTable (stmt=0x556a0f946138, lockmode=8,
context=0x7ffe1987eba0) at tablecmds.c:4101
#16 0x0000556a0e995140 in ProcessUtilitySlow (pstate=0x556a1022c010,
pstmt=0x556a0f946448,
queryString=0x556a0f944fb0 "ALTER TABLE ONLY sch2.flot\n ALTER
COLUMN f SET DATA TYPE TEXT USING pg_catalog.ceiling(\n
cast(sch2.flot.f as float8))", context=PROCESS_UTILITY_TOPLEVEL,
params=0x0, queryEnv=0x0,
dest=0x556a0f946518, qc=0x7ffe1987f4e0) at utility.c:1325

=== Backtrace - PID 3739799 - 1509abe2c5(at)master ===
#3 0x0000556a0e4a669f in visibilitymap_clear (rel=0x556a0fe00490, heapBlk=8,
buf=0, flags=3 '\003') at visibilitymap.c:156
#4 0x0000556a0e48401a in heap_delete (relation=0x556a0fe00490,
tid=0x556a10886dcc, cid=1, crosscheck=0x0, wait=true,
tmfd=0x7ffe1987e530, changingPart=false) at heapam.c:2931
#5 0x0000556a0e484567 in simple_heap_delete (relation=0x556a0fe00490,
tid=0x556a10886dcc) at heapam.c:3078
#6 0x0000556a0e55d566 in CatalogTupleDelete (heapRel=0x556a0fe00490,
tid=0x556a10886dcc) at indexing.c:352
#7 0x0000556a0e559bc7 in index_drop (indexId=20720, concurrent=false,
concurrent_lock_mode=false) at index.c:2349
#8 0x0000556a0e54bb3e in doDeletion (object=0x556a12093570, flags=1)
at dependency.c:1408
#9 0x0000556a0e54b88b in deleteOneObject (object=0x556a12093570,
depRel=0x7ffe1987e7e0, flags=1) at dependency.c:1317
#10 0x0000556a0e549ff1 in deleteObjectsInList (targetObjects=0x556a0fc0f160,
depRel=0x7ffe1987e7e0, flags=1) at dependency.c:278
#11 0x0000556a0e54a1fe in performMultipleDeletions (objects=0x556a103286c8,
behavior=DROP_RESTRICT, flags=1) at dependency.c:439
#12 0x0000556a0e6a0d4d in ATPostAlterTypeCleanup (wqueue=0x7ffe1987e9a8,
tab=0x556a10c86428, lockmode=8) at tablecmds.c:13196
#13 0x0000556a0e68dbc6 in ATRewriteCatalogs (wqueue=0x7ffe1987e9a8,
lockmode=8, context=0x7ffe1987eba0) at tablecmds.c:4888
#14 0x0000556a0e68cda1 in ATController (parsetree=0x556a0f945e80,
rel=0x556a0fee4d08, cmds=0x556a0f945e48, recurse=false, lockmode=8,
context=0x7ffe1987eba0) at tablecmds.c:4455
#15 0x0000556a0e68c9b6 in AlterTable (stmt=0x556a0f945e80, lockmode=8,
context=0x7ffe1987eba0) at tablecmds.c:4101
#16 0x0000556a0e995140 in ProcessUtilitySlow (pstate=0x556a10c86310,
pstmt=0x556a0f946190,
queryString=0x556a0f944fb0 "ALTER TABLE ONLY sch12.bool\n ALTER
COLUMN b SET DATA TYPE TEXT USING
public.postgres_fdw_disconnect_all()",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x556a0f946260, qc=0x7ffe1987f4e0) at utility.c:1325

=== Backtrace - PID 3737305 - 1509abe2c5(at)master ===
#3 0x0000556a0e4a669f in visibilitymap_clear (rel=0x7fcec64529e0,
heapBlk=14, buf=0, flags=3 '\003') at visibilitymap.c:156
#4 0x0000556a0e48401a in heap_delete (relation=0x7fcec64529e0,
tid=0x7fcec6434d5c, cid=1, crosscheck=0x0, wait=true,
tmfd=0x7ffe1987e530, changingPart=false) at heapam.c:2931
#5 0x0000556a0e484567 in simple_heap_delete (relation=0x7fcec64529e0,
tid=0x7fcec6434d5c) at heapam.c:3078
#6 0x0000556a0e55d566 in CatalogTupleDelete (heapRel=0x7fcec64529e0,
tid=0x7fcec6434d5c) at indexing.c:352
#7 0x0000556a0e559bc7 in index_drop (indexId=21557, concurrent=false,
concurrent_lock_mode=false) at index.c:2349
#8 0x0000556a0e54bb3e in doDeletion (object=0x556a10f0d340, flags=1)
at dependency.c:1408
#9 0x0000556a0e54b88b in deleteOneObject (object=0x556a10f0d340,
depRel=0x7ffe1987e7e0, flags=1) at dependency.c:1317
#10 0x0000556a0e549ff1 in deleteObjectsInList (targetObjects=0x556a10703990,
depRel=0x7ffe1987e7e0, flags=1) at dependency.c:278
#11 0x0000556a0e54a1fe in performMultipleDeletions (objects=0x556a0fc85878,
behavior=DROP_RESTRICT, flags=1) at dependency.c:439
#12 0x0000556a0e6a0d4d in ATPostAlterTypeCleanup (wqueue=0x7ffe1987e9a8,
tab=0x556a10bfc5b8, lockmode=8) at tablecmds.c:13196
#13 0x0000556a0e68dbc6 in ATRewriteCatalogs (wqueue=0x7ffe1987e9a8,
lockmode=8, context=0x7ffe1987eba0) at tablecmds.c:4888
#14 0x0000556a0e68cda1 in ATController (parsetree=0x556a0f945ec8,
rel=0x7fcec6443ab0, cmds=0x556a0f945e90, recurse=false, lockmode=8,
context=0x7ffe1987eba0) at tablecmds.c:4455
#15 0x0000556a0e68c9b6 in AlterTable (stmt=0x556a0f945ec8, lockmode=8,
context=0x7ffe1987eba0) at tablecmds.c:4101
#16 0x0000556a0e995140 in ProcessUtilitySlow (pstate=0x556a10bfc4a0,
pstmt=0x556a0f9461d8,
queryString=0x556a0f944fb0 "ALTER TABLE ONLY sch27.chr\n ALTER
COLUMN c SET DATA TYPE TEXT USING sch27.chr.c",
context=PROCESS_UTILITY_TOPLEVEL,
params=0x0, queryEnv=0x0, dest=0x556a0f9462a8, qc=0x7ffe1987f4e0)
at utility.c:1325

Below are backtraces of 2 concurrent crashes on REL_15_STABLE (~month old)

=== Backtrace - c7e21e9664(at)REL_15_STABLE ===
#3 0x000055ceba5222f8 in visibilitymap_clear (rel=0x7f568cdc3b80,
heapBlk=39, buf=0, flags=3 '\003') at visibilitymap.c:156
#4 0x000055ceba4fae90 in heap_delete (relation=0x7f568cdc3b80,
tid=0x55cebc44319c, cid=2, crosscheck=0x0, wait=true,
tmfd=0x7fff74227990, changingPart=false) at heapam.c:2931
#5 0x000055ceba4fb43f in simple_heap_delete (relation=0x7f568cdc3b80,
tid=0x55cebc44319c) at heapam.c:3078
#6 0x000055ceba5df034 in CatalogTupleDelete (heapRel=0x7f568cdc3b80,
tid=0x55cebc44319c) at indexing.c:352
#7 0x000055ceba5d2dc4 in DeleteRelationTuple (relid=19720) at heap.c:1549
#8 0x000055ceba5db6fa in index_drop (indexId=19720, concurrent=false,
concurrent_lock_mode=false) at index.c:2370
#9 0x000055ceba5cd347 in doDeletion (object=0x55cebb750ca4, flags=1)
at dependency.c:1403
#10 0x000055ceba5cd094 in deleteOneObject (object=0x55cebb750ca4,
depRel=0x7fff74227c70, flags=1) at dependency.c:1312
#11 0x000055ceba5cb7fa in deleteObjectsInList
(targetObjects=0x55cebd5d1000, depRel=0x7fff74227c70, flags=1) at
dependency.c:273
#12 0x000055ceba5cba07 in performMultipleDeletions
(objects=0x55cebb750088, behavior=DROP_RESTRICT, flags=1) at
dependency.c:434
#13 0x000055ceba723f95 in ATPostAlterTypeCleanup
(wqueue=0x7fff74227e38, tab=0x55cebb6437e8, lockmode=8) at
tablecmds.c:13203
#14 0x000055ceba71056d in ATRewriteCatalogs (wqueue=0x7fff74227e38,
lockmode=8, context=0x7fff74228030) at tablecmds.c:4869
#15 0x000055ceba70f724 in ATController (parsetree=0x55cebb1041a0,
rel=0x55cebc0a5008, cmds=0x55cebb104148, recurse=false, lockmode=8,
context=0x7fff74228030) at tablecmds.c:4437
#16 0x000055ceba70f339 in AlterTable (stmt=0x55cebb1041a0, lockmode=8,
context=0x7fff74228030) at tablecmds.c:4083
#17 0x000055ceba9f4543 in ProcessUtilitySlow (pstate=0x55cebb6436d0,
pstmt=0x55cebb1044f0,
queryString=0x55cebb102f30 "ALTER TABLE ONLY sch15.chr\n ALTER
COLUMN c SET DATA TYPE TEXT USING pg_catalog.varchar(\n
cast(pg_catalog.session_user() as name))",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x55cebb1045e0, qc=0x7fff74228970) at utility.c:1325

=== Backtrace - c7e21e9664(at)REL_15_STABLE ===
#3 0x000055ceba5222f8 in visibilitymap_clear (rel=0x7f568cc4f940,
heapBlk=56, buf=0, flags=3 '\003') at visibilitymap.c:156
#4 0x000055ceba4fae90 in heap_delete (relation=0x7f568cc4f940,
tid=0x55cebb41a624, cid=1, crosscheck=0x0, wait=true,
tmfd=0x7fff74227990, changingPart=false) at heapam.c:2931
#5 0x000055ceba4fb43f in simple_heap_delete (relation=0x7f568cc4f940,
tid=0x55cebb41a624) at heapam.c:3078
#6 0x000055ceba5df034 in CatalogTupleDelete (heapRel=0x7f568cc4f940,
tid=0x55cebb41a624) at indexing.c:352
#7 0x000055ceba5d2dc4 in DeleteRelationTuple (relid=21181) at heap.c:1549
#8 0x000055ceba5db6fa in index_drop (indexId=21181, concurrent=false,
concurrent_lock_mode=false) at index.c:2370
#9 0x000055ceba5cd347 in doDeletion (object=0x55cebb93a990, flags=1)
at dependency.c:1403
#10 0x000055ceba5cd094 in deleteOneObject (object=0x55cebb93a990,
depRel=0x7fff74227c70, flags=1) at dependency.c:1312
#11 0x000055ceba5cb7fa in deleteObjectsInList
(targetObjects=0x55cebde36870, depRel=0x7fff74227c70, flags=1) at
dependency.c:273
#12 0x000055ceba5cba07 in performMultipleDeletions
(objects=0x55cebb93abc8, behavior=DROP_RESTRICT, flags=1) at
dependency.c:434
#13 0x000055ceba723f95 in ATPostAlterTypeCleanup
(wqueue=0x7fff74227e38, tab=0x55cebb669928, lockmode=8) at
tablecmds.c:13203
#14 0x000055ceba71056d in ATRewriteCatalogs (wqueue=0x7fff74227e38,
lockmode=8, context=0x7fff74228030) at tablecmds.c:4869
#15 0x000055ceba70f724 in ATController (parsetree=0x55cebb81f838,
rel=0x7f568cc4a8a8, cmds=0x55cebb81f7e0, recurse=false, lockmode=8,
context=0x7fff74228030) at tablecmds.c:4437
#16 0x000055ceba70f339 in AlterTable (stmt=0x55cebb81f838, lockmode=8,
context=0x7fff74228030) at tablecmds.c:4083
#17 0x000055ceba9f4543 in ProcessUtilitySlow (pstate=0x55cebb669810,
pstmt=0x55cebb81fb88,
queryString=0x55cebb102f30 "ALTER TABLE ONLY sch10.num\n ALTER
COLUMN n SET DATA TYPE TEXT USING pg_catalog.numeric_add(\n
cast(pg_catalog.numeric_div_trunc(\n cast(sch10.num.n as
\"numeric\"),\n cast(sch10.num.n as \""...,
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x55cebb81fc78, qc=0x7fff74228970) at utility.c:1325

Below are backtraces of 2 concurrent crashes on REL_13_STABLE (~month old)

=== Backtrace - 7cdd0c2d7c(at)REL_13_STABLE ===
#3 0x00005572a01852f8 in visibilitymap_clear (rel=0x7fc91e5bedc8,
heapBlk=128, buf=0, flags=3 '\003') at visibilitymap.c:156
#4 0x00005572a015de90 in heap_delete (relation=0x7fc91e5bedc8,
tid=0x5572a2f63b2c, cid=2, crosscheck=0x0, wait=true,
tmfd=0x7ffda170ae60, changingPart=false) at heapam.c:2931
#5 0x00005572a015e43f in simple_heap_delete (relation=0x7fc91e5bedc8,
tid=0x5572a2f63b2c) at heapam.c:3078
#6 0x00005572a0242034 in CatalogTupleDelete (heapRel=0x7fc91e5bedc8,
tid=0x5572a2f63b2c) at indexing.c:352
#7 0x00005572a0235e7b in DeleteAttributeTuples (relid=628267) at heap.c:1586
#8 0x00005572a023e6f0 in index_drop (indexId=628267,
concurrent=false, concurrent_lock_mode=false) at index.c:2365
#9 0x00005572a0230347 in doDeletion (object=0x5572a2f99944, flags=1)
at dependency.c:1403
#10 0x00005572a0230094 in deleteOneObject (object=0x5572a2f99944,
depRel=0x7ffda170b1a0, flags=1) at dependency.c:1312
#11 0x00005572a022e7fa in deleteObjectsInList
(targetObjects=0x5572a2f63088, depRel=0x7ffda170b1a0, flags=1) at
dependency.c:273
#12 0x00005572a022ea07 in performMultipleDeletions
(objects=0x5572a2f74998, behavior=DROP_RESTRICT, flags=1) at
dependency.c:434
#13 0x00005572a0386f95 in ATPostAlterTypeCleanup
(wqueue=0x7ffda170b368, tab=0x5572a2fb9790, lockmode=8) at
tablecmds.c:13203
#14 0x00005572a037356d in ATRewriteCatalogs (wqueue=0x7ffda170b368,
lockmode=8, context=0x7ffda170b560) at tablecmds.c:4869
#15 0x00005572a0372724 in ATController (parsetree=0x5572a266ee60,
rel=0x5572a2c56e68, cmds=0x5572a266ee08, recurse=false, lockmode=8,
context=0x7ffda170b560) at tablecmds.c:4437
#16 0x00005572a0372339 in AlterTable (stmt=0x5572a266ee60, lockmode=8,
context=0x7ffda170b560) at tablecmds.c:4083
#17 0x00005572a0657543 in ProcessUtilitySlow (pstate=0x5572a2fb9640,
pstmt=0x5572a266f1b0, queryString=0x5572a266df30 "ALTER TABLE ONLY
sch7.bool\n ALTER COLUMN b SET DATA TYPE TEXT USING
pg_catalog.pg_is_wal_replay_paused()",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x5572a266f2a0, qc=0x7ffda170bea0) at utility.c:1325

=== Backtrace - 7cdd0c2d7c(at)REL_13_STABLE ===
#3 0x00005572a01852f8 in visibilitymap_clear (rel=0x7fc91e5bedc8,
heapBlk=98, buf=0, flags=3 '\003') at visibilitymap.c:156
#4 0x00005572a015de90 in heap_delete (relation=0x7fc91e5bedc8,
tid=0x5572a308f82c, cid=1, crosscheck=0x0, wait=true,
tmfd=0x7ffda170ae60, changingPart=false) at heapam.c:2931
#5 0x00005572a015e43f in simple_heap_delete (relation=0x7fc91e5bedc8,
tid=0x5572a308f82c) at heapam.c:3078
#6 0x00005572a0242034 in CatalogTupleDelete (heapRel=0x7fc91e5bedc8,
tid=0x5572a308f82c) at indexing.c:352
#7 0x00005572a0235e7b in DeleteAttributeTuples (relid=537682) at heap.c:1586
#8 0x00005572a023e6f0 in index_drop (indexId=537682,
concurrent=false, concurrent_lock_mode=false) at index.c:2365
#9 0x00005572a0230347 in doDeletion (object=0x5572a3092080, flags=1)
at dependency.c:1403
#10 0x00005572a0230094 in deleteOneObject (object=0x5572a3092080,
depRel=0x7ffda170b1a0, flags=1) at dependency.c:1312
#11 0x00005572a022e7fa in deleteObjectsInList
(targetObjects=0x5572a30bdef8, depRel=0x7ffda170b1a0, flags=1) at
dependency.c:273
#12 0x00005572a022ea07 in performMultipleDeletions
(objects=0x5572a308fa10, behavior=DROP_RESTRICT, flags=1) at
dependency.c:434
#13 0x00005572a0386f95 in ATPostAlterTypeCleanup
(wqueue=0x7ffda170b368, tab=0x5572a31a98f8, lockmode=8) at
tablecmds.c:13203
#14 0x00005572a037356d in ATRewriteCatalogs (wqueue=0x7ffda170b368,
lockmode=8, context=0x7ffda170b560) at tablecmds.c:4869
#15 0x00005572a0372724 in ATController (parsetree=0x5572a266fb40,
rel=0x5572a28b3628, cmds=0x5572a266fae8, recurse=false, lockmode=8,
context=0x7ffda170b560) at tablecmds.c:4437
#16 0x00005572a0372339 in AlterTable (stmt=0x5572a266fb40, lockmode=8,
context=0x7ffda170b560) at tablecmds.c:4083
#17 0x00005572a0657543 in ProcessUtilitySlow (pstate=0x5572a31a97e0,
pstmt=0x5572a266fd20, queryString=0x5572a266df30 "ALTER TABLE ONLY
sch2.chr\n ALTER COLUMN c SET DATA TYPE TEXT USING
pg_catalog.varcharin(\n cast(public.gtrgm_out(\n
cast(cast(null as public.gtrgm) as public.gtrgm)) as cstring),\n
cast(pg"..., context=PROCESS_UTILITY_TOPLEVEL, params=0x0,
queryEnv=0x0, dest=0x5572a30b2fe0, qc=0x7ffda170bea0) at utility.c:1325

The issue isn't easily reproducible and thus posting this as an
aggregated report. Let me know, if changing something in the (SQLSmith
based) test-setup could help triaging this further. Also, can provide
full backtraces, if required.

Reference:
1) https://www.postgresql.org/message-id/2247102.1618008027@sss.pgh.pa.us
2) https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=5f12bc94dcc60403bdfec6ea3d97aa616a512d9e

-
Robins Tharakan
Amazon Web Services

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2022-08-22 06:23:59 BUG #17591: elog(ERROR) cause SharedSnapshotLock deadlock
Previous Message Richard Guo 2022-08-22 03:29:47 Re: foreign join error "variable not found in subplan target list"