Hi,

Just found $SUBJECT involving time with time zone and a subselect. I
still don't have narrowed to the exact table/index minimal schema but
if you run this query on the regression database it will creash.

```
update public.brintest_multi set
  timetzcol = (select tz from generate_series('2021-01-01'::timestamp
with time zone, '2021-01-31', '5 days') tz limit 1)
;
```

attached a backtrace. Let me know if you need extra information.

--
Jaime Casanova
Director de Servicios Profesionales
SYSTEMGUARDS - Consultores de PostgreSQL
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
        set = {__val = {4194304, 140736618859920, 2, 6, 6570493, 
93847671406576, 4611686018427388799, 140140941466278, 0, 
            281470681751456, 0, 0, 0, 0, 0, 0}}
        pid = <optimized out>
        tid = <optimized out>
        ret = <optimized out>
#1  0x00007f751ad08535 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, 
sa_mask = {__val = {0, 0, 0, 0, 0, 140140939223029, 
              2, 7004563297194213396, 7003431879952131129, 93847671406576, 
7003772732868633408, 0, 18123550304647508992, 
              140736618860160, 93847715200152, 140736618861024}}, sa_flags = 
-1658978320, sa_restorer = 0x555a9fba3c98}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x0000555a9d872557 in ExceptionalCondition (conditionName=0x555a9d8ec6c3 
"delta >= 0", 
    errorType=0x555a9d8ebf74 "FailedAssertion", fileName=0x555a9d8ebf60 
"brin_minmax_multi.c", lineNumber=2095) at assert.c:69
No locals.
#3  0x0000555a9d1e9933 in brin_minmax_multi_distance_timetz 
(fcinfo=0x7fffcc2c9250) at brin_minmax_multi.c:2095
        delta = -6785000000
        ta = 0x555a9fb99720
        tb = 0x555a9fb9c768
#4  0x0000555a9d87c6f1 in FunctionCall2Coll (flinfo=0x555a9fbd7c88, 
collation=0, arg1=93847715157792, arg2=93847715170152)
    at fmgr.c:1163
        fcinfodata = {fcinfo = {flinfo = 0x555a9fbd7c88, context = 0x0, 
resultinfo = 0x0, fncollation = 0, isnull = false, 
            nargs = 2, args = 0x7fffcc2c9270}, 
          fcinfo_data = "\210|\275\237ZU", '\000' <repeats 24 times>, "\002\000 
\227\271\237ZU\000\000\000\000\000\000\000\000\000\000hÇı\237ZU\000\000\000\000\000@\317#\270A"}
        fcinfo = 0x7fffcc2c9250
        result = 4735574381219020800
        __func__ = "FunctionCall2Coll"
#5  0x0000555a9d1e85b7 in build_distances (distanceFn=0x555a9fbd7c88, 
colloid=0, eranges=0x555a9fba3b50, neranges=10)
    at brin_minmax_multi.c:1350
        a1 = 93847715157792
        a2 = 93847715170152
        r = 4735574381219020800
        i = 4
        ndistances = 9
        distances = 0x555a9fba3c68
#6  0x0000555a9d1e912f in compactify_ranges (bdesc=0x555a9fbd72a8, 
ranges=0x555a9fc02df8, max_values=32)
    at brin_minmax_multi.c:1820
        cmpFn = 0x555a9fbd7cc0
        distanceFn = 0x555a9fbd7c88
        eranges = 0x555a9fba3b50
        neranges = 10
        distances = 0x555a00000010
        ctx = 0x555a9fba3a30
        oldctx = 0x555a9fb9b9f0
#7  0x0000555a9d1ea409 in brin_minmax_multi_serialize (bdesc=0x555a9fbd72a8, 
src=93847715589624, dst=0x555a9fb9bea8)
    at brin_minmax_multi.c:2333
        ranges = 0x555a9fc02df8
        s = 0x555a9fb9d688
#8  0x0000555a9d1f0601 in brin_form_tuple (brdesc=0x555a9fbd72a8, blkno=0, 
tuple=0x555a9fb9bb10, size=0x7fffcc2c94e8)
    at brin_tuple.c:165
        datumno = 1
        values = 0x555a9fb9c108
        nulls = 0x555a9fb9c920
        anynulls = true
        rettuple = 0x89fc97d00
        keyno = 15
        idxattno = 15
        phony_infomask = 0
        phony_nullbitmap = 0x555a9fb9c9a0 "\177\177\177~\177\177\177\177"
        len = 93847671475524
        hoff = 2048
        data_len = 93847715170728
        i = 32767
        untoasted_values = 0x555a9fb9c220
        nuntoasted = 0
#9  0x0000555a9d1e09c1 in brininsert (idxRel=0x555a9fc97dd0, 
values=0x7fffcc2c9640, nulls=0x7fffcc2c9620, heaptid=0x555a9fb92ea8, 
    heapRel=0x555a9fc83540, checkUnique=UNIQUE_CHECK_NO, indexUnchanged=false, 
indexInfo=0x555a9fbac900) at brin.c:281
        lp = 0x7f751a1abfb8
        origsz = 1592
        newsz = 93847674317391
        page = 0x7f751a1abf80 "\004"
        origtup = 0x555a9fb9c9c0
        newtup = 0x7fffcc2c9520
        samepage = false
        need_insert = true
        off = 9
        brtup = 0x7f751a1ac1d8
        dtup = 0x555a9fb9bb10
        pagesPerRange = 1
        origHeapBlk = 0
        heapBlk = 0
        bdesc = 0x555a9fbd72a8
        revmap = 0x555a9fb93248
        buf = 16301
        tupcxt = 0x555a9fb9b9f0
        oldcxt = 0x555a9fbafa80
        autosummarize = false
        __func__ = "brininsert"
#10 0x0000555a9d280a1e in index_insert (indexRelation=0x555a9fc97dd0, 
values=0x7fffcc2c9640, isnull=0x7fffcc2c9620, 
    heap_t_ctid=0x555a9fb92ea8, heapRelation=0x555a9fc83540, 
checkUnique=UNIQUE_CHECK_NO, indexUnchanged=false, 
    indexInfo=0x555a9fbac900) at indexam.c:193
        __func__ = "index_insert"
#11 0x0000555a9d493a2f in ExecInsertIndexTuples (resultRelInfo=0x555a9fbac470, 
slot=0x555a9fb92e78, estate=0x555a9fbafba0, 
    update=true, noDupErr=false, specConflict=0x0, arbiterIndexes=0x0) at 
execIndexing.c:416
        applyNoDupErr = false
        checkUnique = UNIQUE_CHECK_NO
        indexRelation = 0x555a9fc97dd0
        indexInfo = 0x555a9fbac900
        indexUnchanged = false
        satisfiesConstraint = false
        tupleid = 0x555a9fb92ea8
        result = 0x0
        i = 0
        numIndices = 1
        relationDescs = 0x555a9fbacf88
        heapRelation = 0x555a9fc83540
        indexInfoArray = 0x555a9fbacfa8
        econtext = 0x555a9fb939c0
        values = {1005713280000, 800, 800, 8800, 93847715133420, 1065353216, 0, 
93847715133440, 93847715133446, 93847715133453, 
          7200, 19630000000, 18446083844818551616, 18445887828109551616, 
93847715133488, 93847715133504, 93847715133516, 
          93847715133521, 100352, 0, 140736618862400, 93847671962456, 
140736618862640, 140736618862636, 0, 93847714641432, 1, 
          93847715131000, 140736618862834, 93847716115776, 12136208, 
93847715133352}
        isnull = {false <repeats 24 times>, 212, 55, 185, 159, 90, 85, false, 
false}
#12 0x0000555a9d4d8d50 in ExecUpdate (mtstate=0x555a9fbb17b0, 
resultRelInfo=0x555a9fbac470, tupleid=0x7fffcc2c98f2, oldtuple=0x0, 
    slot=0x555a9fb92e78, planSlot=0x555a9fbad710, epqstate=0x555a9fbb18a8, 
estate=0x555a9fbafba0, canSetTag=true)
    at nodeModifyTable.c:1634
        lockmode = LockTupleNoKeyExclusive
        partition_constraint_failed = false
        update_indexes = true
        resultRelationDesc = 0x555a9fc83540
        result = TM_Ok
        tmfd = {ctid = {ip_blkid = {bi_hi = 55056, bi_lo = 40890}, ip_posid = 
21850}, xmax = 2679713920, cmax = 21850, 
          traversed = 40}
        recheckIndexes = 0x0
        __func__ = "ExecUpdate"
#13 0x0000555a9d4d9dc9 in ExecModifyTable (pstate=0x555a9fbb17b0) at 
nodeModifyTable.c:2254
        node = 0x555a9fbb17b0
        estate = 0x555a9fbafba0
        operation = CMD_UPDATE
        resultRelInfo = 0x555a9fbac470
        subplanstate = 0x555a9fbacfc8
        junkfilter = 0x555a9fb93080
        slot = 0x555a9fb92e78
        planSlot = 0x555a9fbad710
        tupleid = 0x7fffcc2c98f2
        tuple_ctid = {ip_blkid = {bi_hi = 0, bi_lo = 0}, ip_posid = 9}
        oldtupdata = {t_len = 3425474800, t_self = {ip_blkid = {bi_hi = 32767, 
bi_lo = 0}, ip_posid = 5870}, t_tableOid = 21850, 
          t_data = 0x555a9fb930d8}
        oldtuple = 0x0
        proute = 0x0
        relinfos = 0x0
        lc = 0xe300000001
        __func__ = "ExecModifyTable"
#14 0x0000555a9d4a1007 in ExecProcNodeFirst (node=0x555a9fbb17b0) at 
execProcnode.c:456
No locals.
#15 0x0000555a9d49541b in ExecProcNode (node=0x555a9fbb17b0) at 
../../../src/include/executor/executor.h:247
No locals.
#16 0x0000555a9d497d77 in ExecutePlan (estate=0x555a9fbafba0, 
planstate=0x555a9fbb17b0, use_parallel_mode=false, 
    operation=CMD_UPDATE, sendTuples=false, numberTuples=0, 
direction=ForwardScanDirection, dest=0x555a9fbe7e48, 
    execute_once=true) at execMain.c:1528
        slot = 0x555a9fbafba0
        current_tuple_count = 0
#17 0x0000555a9d495a7c in standard_ExecutorRun (queryDesc=0x555a9fbd9590, 
direction=ForwardScanDirection, count=0, 
    execute_once=true) at execMain.c:350
        estate = 0x555a9fbafba0
        operation = CMD_UPDATE
        dest = 0x555a9fbe7e48
        sendTuples = false
        oldcontext = 0x555a9fbd9470
        __func__ = "standard_ExecutorRun"
#18 0x0000555a9d495892 in ExecutorRun (queryDesc=0x555a9fbd9590, 
direction=ForwardScanDirection, count=0, execute_once=true)
    at execMain.c:294
No locals.
#19 0x0000555a9d6e1d85 in ProcessQuery (plan=0x555a9fc70d58, 
    sourceText=0x555a9fa988e0 "update public.brintest_multi set \n  timetzcol = 
(select tz from generate_series('2021-01-01'::timestamp with time zone, 
'2021-01-31', '5 days') tz limit 1 offset 4)\n;", params=0x0, queryEnv=0x0, 
dest=0x555a9fbe7e48, 
    qc=0x7fffcc2c9d10) at pquery.c:160
        queryDesc = 0x555a9fbd9590
#20 0x0000555a9d6e3742 in PortalRunMulti (portal=0x555a9fb039a0, 
isTopLevel=true, setHoldSnapshot=false, dest=0x555a9fbe7e48, 
    altdest=0x555a9fbe7e48, qc=0x7fffcc2c9d10) at pquery.c:1267
        pstmt = 0x555a9fc70d58
        stmtlist_item__state = {l = 0x555a9fbe7df0, i = 0}
        active_snapshot_set = true
        stmtlist_item = 0x555a9fbe7e08
#21 0x0000555a9d6e2cc4 in PortalRun (portal=0x555a9fb039a0, 
count=9223372036854775807, isTopLevel=true, run_once=true, 
    dest=0x555a9fbe7e48, altdest=0x555a9fbe7e48, qc=0x7fffcc2c9d10) at 
pquery.c:779
        _save_exception_stack = 0x7fffcc2c9e20
        _save_context_stack = 0x0
        _local_sigjmp_buf = {{__jmpbuf = {0, 6890411692784566327, 
93847671406576, 140736618865472, 0, 0, 6890411692744720439, 
              780541552607576119}, __mask_was_saved = 0, __saved_mask = {__val 
= {19822817785, 93847715479088, 128, 
                93847714105280, 93847714552240, 140736618863728, 64880, 
93847678360869, 93847715478432, 140736618863760, 
                93847678539968, 13, 112, 93847715479224, 112, 3425475744}}}}
        _do_rethrow = false
        result = false
        nprocessed = 93847715479112
        saveTopTransactionResourceOwner = 0x555a9fac95c0
        saveTopTransactionContext = 0x555a9fb1b4c0
        saveActivePortal = 0x0
        saveResourceOwner = 0x555a9fac95c0
        savePortalContext = 0x0
        saveMemoryContext = 0x555a9fb1b4c0
        __func__ = "PortalRun"
#22 0x0000555a9d6dc616 in exec_simple_query (
    query_string=0x555a9fa988e0 "update public.brintest_multi set \n  timetzcol 
= (select tz from generate_series('2021-01-01'::timestamp with time zone, 
'2021-01-31', '5 days') tz limit 1 offset 4)\n;") at postgres.c:1184
        snapshot_set = true
        per_parsetree_context = 0x0
        plantree_list = 0x555a9fbe7df0
        parsetree = 0x555a9fa99f68
        commandTag = CMDTAG_UPDATE
        qc = {commandTag = CMDTAG_UNKNOWN, nprocessed = 0}
        querytree_list = 0x555a9fbc29c8
        portal = 0x555a9fb039a0
        receiver = 0x555a9fbe7e48
        format = 0
        parsetree_item__state = {l = 0x555a9fa99fa0, i = 0}
        dest = DestRemote
        oldcontext = 0x555a9fb1b4c0
        parsetree_list = 0x555a9fa99fa0
        parsetree_item = 0x555a9fa99fb8
        save_log_statement_stats = false
        was_logged = false
        use_implicit_block = false
        msec_str = 
"\340\210\251\237ZU\000\000\246\000\000\000\006\000\000\000`\235,\314\377\177\000\000\020\336P\235\246\000\000"
        __func__ = "exec_simple_query"
#23 0x0000555a9d6e0d3f in PostgresMain (argc=1, argv=0x7fffcc2c9fa0, 
dbname=0x555a9fac7880 "regression", 
    username=0x555a9fac7858 "jcasanov") at postgres.c:4414
        query_string = 0x555a9fa988e0 "update public.brintest_multi set \n  
timetzcol = (select tz from generate_series('2021-01-01'::timestamp with time 
zone, '2021-01-31', '5 days') tz limit 1 offset 4)\n;"
        firstchar = 81
        input_message = {
          data = 0x555a9fa988e0 "update public.brintest_multi set \n  timetzcol 
= (select tz from generate_series('2021-01-01'::timestamp with time zone, 
'2021-01-31', '5 days') tz limit 1 offset 4)\n;", len = 167, maxlen = 1024, 
cursor = 167}
        local_sigjmp_buf = {{__jmpbuf = {0, 6890411692878938167, 
93847671406576, 140736618865472, 0, 0, 6890411692824412215, 
              780541553613684791}, __mask_was_saved = 1, __saved_mask = {__val 
= {4194304, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
                1099511627520, 0, 0, 4294901760, 18446462598732840960, 0}}}}
        send_ready_for_query = false
        idle_in_transaction_timeout_enabled = false
        idle_session_timeout_enabled = false
        __func__ = "PostgresMain"
#24 0x0000555a9d618dbe in BackendRun (port=0x555a9fabe790) at postmaster.c:4483
        av = {0x555a9da19267 "postgres", 0x0}
        ac = 1
#25 0x0000555a9d6186ed in BackendStartup (port=0x555a9fabe790) at 
postmaster.c:4205
        bn = 0x555a9fabb940
        pid = 0
        __func__ = "BackendStartup"
#26 0x0000555a9d614a84 in ServerLoop () at postmaster.c:1737
        port = 0x555a9fabe790
        i = 2
        rmask = {fds_bits = {128, 0 <repeats 15 times>}}
        selres = 1
        now = 1617209413
        readmask = {fds_bits = {224, 0 <repeats 15 times>}}
        nSockets = 8
        last_lockfile_recheck_time = 1617209412
        last_touch_time = 1617209114
        __func__ = "ServerLoop"
#27 0x0000555a9d6142d3 in PostmasterMain (argc=3, argv=0x555a9fa91ee0) at 
postmaster.c:1409
        opt = -1
        status = 0
        userDoption = 0x555a9fab57c0 "data"
        listen_addr_saved = true
        i = 64
        output_config_variable = 0x0
        __func__ = "PostmasterMain"
#28 0x0000555a9d510f67 in main (argc=3, argv=0x555a9fa91ee0) at main.c:209
        do_check_root = true

Reply via email to