I got a crash running the below query on the regression database:

"""
select pg_catalog.json_object_agg_unique(10,
            cast(ref_0.level2_no as int4)) 
                over (partition by ref_0.parent_no 
                        order by ref_0.level2_no)
from public.transition_table_level2 as ref_0;
"""

Attached the backtrace.

PS: I'm cc'ing Andrew and Nikita because my feeling is that this is 
f4fb45d15c59d7add2e1b81a9d477d0119a9691a responsability. 

-- 
Jaime Casanova
Director de Servicios Profesionales
SystemGuards - Consultores de PostgreSQL
#0  0x000055625fb793a5 in hash_search (hashp=0x5562614a7e20, 
keyPtr=0x7fff3bedf520, 
    action=HASH_ENTER, foundPtr=0x7fff3bedf51f) at dynahash.c:959
No locals.
#1  0x000055625fa57675 in json_unique_check_key (cxt=0x556261467d18, 
    key=0x556261467d9c "\"10\"", object_id=0) at json.c:998
        entry = {key = 0x556261467d9c "\"10\"", key_len = 4, object_id = 0}
        found = false
#2  0x000055625fa57ac2 in json_object_agg_transfn_worker 
(fcinfo=0x7fff3bedf600, 
    absent_on_null=false, unique_keys=true) at json.c:1152
        key = 0x556261467d9c "\"10\""
        aggcontext = 0x556261467be0
        oldcontext = 0x556261460310
        state = 0x556261467d00
        out = 0x556261467d58
        arg = 10
        skip = false
        key_offset = 12
        __func__ = "json_object_agg_transfn_worker"
#3  0x000055625fa57c04 in json_object_agg_unique_transfn 
(fcinfo=0x7fff3bedf600) at json.c:1198
No locals.
#4  0x000055625f7c14ab in advance_windowaggregate (winstate=0x55626145fef8, 
    perfuncstate=0x55626147bb68, peraggstate=0x556261477da0) at 
nodeWindowAgg.c:345
        fcinfodata = {fcinfo = {flinfo = 0x556261477db0, context = 
0x55626145fef8, 
            resultinfo = 0x0, fncollation = 0, isnull = false, nargs = 3, 
            args = 0x7fff3bedf620}, 
          fcinfo_data = "\260}GabU\000\000\370\376EabU", '\000' <repeats 15 
times>, "U\003\000\000}FabU\000\000\000\376EabU\000\000\n", '\000' <repeats 12 
times>, 
"U\001\000\002\000\000\000\000\000\000\000\000\254t\263;\177\000\000\200[i\263;\177\000\000\004t\370\252Vf\000\000\340\366\355;\000\000@\000X\236P\253;\177\000\000\220\366\355;\377\177\000\000\276\240\227_bU\000\000m\264\323_\000\000@\000\260\366\355;\377\177\000\000\340\366\355;\377\177\000\000\335\031\230_bU\000\000\300\366\355;\377\177\000\000@\236P\253;\177\000\000\000\000\000\000\001\000\004\206X\236P\253;\177\000\000\340\366\355;\377\177\000\000"...}
        fcinfo = 0x7fff3bedf600
        wfuncstate = 0x55626146fba8
        numArguments = 2
        newVal = 93881027165152
        arg = 0x0
        i = 3
        oldContext = 0x55626145fba0
        econtext = 0x556261460310
        filter = 0x0
        __func__ = "advance_windowaggregate"
#5  0x000055625f7c26b0 in eval_windowaggregates (winstate=0x55626145fef8) at 
nodeWindowAgg.c:964
        ret = 1
        peraggstate = 0x556261477da0
        wfuncno = 0
        numaggs = 1
        numaggs_restart = 0
        i = 0
        aggregatedupto_nonrestarted = 1
        oldContext = 0x2000
        econtext = 0x556261460400
        agg_winobj = 0x55626147dfa0
        agg_row_slot = 0x55626146e0d0
        temp_slot = 0x55626146e1e8
        __func__ = "eval_windowaggregates"
#6  0x000055625f7c511e in ExecWindowAgg (pstate=0x55626145fef8) at 
nodeWindowAgg.c:2207
        winstate = 0x55626145fef8
        econtext = 0x556261460400
        i = 1
        numfuncs = 1
        __func__ = "ExecWindowAgg"
#7  0x000055625f767494 in ExecProcNode (node=0x55626145fef8)
    at ../../../src/include/executor/executor.h:259
No locals.
#8  0x000055625f76a153 in ExecutePlan (estate=0x55626145fcc0, 
planstate=0x55626145fef8, 
    use_parallel_mode=false, operation=CMD_SELECT, sendTuples=true, 
numberTuples=0, 
    direction=ForwardScanDirection, dest=0x55626145c9a8, execute_once=true) at 
execMain.c:1636
        slot = 0x55626147dff8
        current_tuple_count = 1
#9  0x000055625f767b3a in standard_ExecutorRun (queryDesc=0x5562613abac0, 
    direction=ForwardScanDirection, count=0, execute_once=true) at 
execMain.c:363
        estate = 0x55626145fcc0
        operation = CMD_SELECT
        dest = 0x55626145c9a8
        sendTuples = true
        oldcontext = 0x5562613ab9a0
        __func__ = "standard_ExecutorRun"
#10 0x000055625f767950 in ExecutorRun (queryDesc=0x5562613abac0, 
direction=ForwardScanDirection, 
    count=0, execute_once=true) at execMain.c:307
No locals.
#11 0x000055625f9cdf5a in PortalRunSelect (portal=0x5562613ef590, forward=true, 
count=0, 
    dest=0x55626145c9a8) at pquery.c:924
        queryDesc = 0x5562613abac0
        direction = ForwardScanDirection
        nprocessed = 1005453488
        __func__ = "PortalRunSelect"
#12 0x000055625f9cdc05 in PortalRun (portal=0x5562613ef590, 
count=9223372036854775807, 
    isTopLevel=true, run_once=true, dest=0x55626145c9a8, 
altdest=0x55626145c9a8, 
    qc=0x7fff3bee00e0) at pquery.c:768
        _save_exception_stack = 0x7fff3bee01e0
        _save_context_stack = 0x0
        _local_sigjmp_buf = {{__jmpbuf = {0, 1459970896967793652, 
93880993820672, 
              140734198843120, 0, 0, 1459970899914292212, 4717541698482240500}, 
            __mask_was_saved = 0, __saved_mask = {__val = {18811108186, 
93881027119504, 128, 
                93881026258832, 93881026394528, 140734198841408, 4592, 
93881026394944, 
                93881027107712, 140734198841440, 93881001210490, 13, 112, 
93881027119640, 112, 
                1005453424}}}}
        _do_rethrow = false
        result = false
        nprocessed = 93881027119528
        saveTopTransactionResourceOwner = 0x556261404a40
        saveTopTransactionContext = 0x556261410600
        saveActivePortal = 0x0
        saveResourceOwner = 0x556261404a40
        savePortalContext = 0x0
        saveMemoryContext = 0x556261410600
        __func__ = "PortalRun"
#13 0x000055625f9c75a0 in exec_simple_query (
    query_string=0x55626138a8b0 "select  \n          
pg_catalog.json_object_agg_unique(10,\n", ' ' <repeats 12 times>, 
"cast(ref_0.level2_no as int4)) over (partition by ref_0.parent_no order by 
ref_0.level2_no) \nfrom \n      public.transition_table_le"...) at 
postgres.c:1250
        snapshot_set = true
        per_parsetree_context = 0x0
        plantree_list = 0x55626145c950
        parsetree = 0x55626138c028
        commandTag = CMDTAG_SELECT
        qc = {commandTag = CMDTAG_UNKNOWN, nprocessed = 0}
        querytree_list = 0x556261459cd0
        portal = 0x5562613ef590
        receiver = 0x55626145c9a8
        format = 0
        parsetree_item__state = {l = 0x55626138c060, i = 0}
        dest = DestRemote
        oldcontext = 0x556261410600
        parsetree_list = 0x55626138c060
        parsetree_item = 0x55626138c078
        save_log_statement_stats = false
        was_logged = false
        use_implicit_block = false
        msec_str = 
"\260\250\070abU\000\000\327\000\000\000\006\000\000\000\060\001\356;\377\177\000\000Ld~_\327\000\000"
        __func__ = "exec_simple_query"
#14 0x000055625f9cbcda in PostgresMain (dbname=0x5562613b7480 "regression", 
    username=0x5562613b7458 "jcasanov") at postgres.c:4520
        query_string = 0x55626138a8b0 "select  \n          
pg_catalog.json_object_agg_unique(10,\n", ' ' <repeats 12 times>, 
"cast(ref_0.level2_no as int4)) over (partition by ref_0.parent_no order by 
ref_0.level2_no) \nfrom \n      public.transition_table_le"...
        firstchar = 81
        input_message = {
          data = 0x55626138a8b0 "select  \n          
pg_catalog.json_object_agg_unique(10,\n", ' ' <repeats 12 times>, 
"cast(ref_0.level2_no as int4)) over (partition by ref_0.parent_no order by 
ref_0.level2_no) \nfrom \n      public.transition_table_le"..., len = 216, 
maxlen = 1024, 
          cursor = 216}
        local_sigjmp_buf = {{__jmpbuf = {0, 1459970897097817076, 
93880993820672, 
              140734198843120, 0, 0, 1459970896999250932, 4717541701592316916}, 
            __mask_was_saved = 1, __saved_mask = {__val = {4194304, 15680, 979, 
                18446744073709551536, 0, 0, 139894400873443, 3904, 0, 
140734198842096, 
                93880993820672, 140734198843120, 93881001163712, 15616, 
93881026232160, 0}}}}
        send_ready_for_query = false
        idle_in_transaction_timeout_enabled = false
        idle_session_timeout_enabled = false
        __func__ = "PostgresMain"
#15 0x000055625f8fa38a in BackendRun (port=0x5562613afbb0) at postmaster.c:4593
No locals.
#16 0x000055625f8f9cd6 in BackendStartup (port=0x5562613afbb0) at 
postmaster.c:4321
        bn = 0x5562613aed60
        pid = 0
        __func__ = "BackendStartup"
#17 0x000055625f8f5f1d in ServerLoop () at postmaster.c:1801
        port = 0x5562613afbb0
        i = 2
        rmask = {fds_bits = {128, 0 <repeats 15 times>}}
        selres = 1
        now = 1648875964
        readmask = {fds_bits = {224, 0 <repeats 15 times>}}
        nSockets = 8
        last_lockfile_recheck_time = 1648875960
        last_touch_time = 1648875960
        __func__ = "ServerLoop"
#18 0x000055625f8f576c in PostmasterMain (argc=3, argv=0x556261383ec0) at 
postmaster.c:1473
        opt = -1
        status = 0
        userDoption = 0x5562613a7830 "data"
        listen_addr_saved = true
        i = 64
        output_config_variable = 0x0
        __func__ = "PostmasterMain"
#19 0x000055625f7e96f4 in main (argc=3, argv=0x556261383ec0) at main.c:202
        do_check_root = true

Reply via email to