Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4tGV-0003Lx-RY for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Apr 2018 19:12:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f4tGS-0000mU-F7 for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Apr 2018 19:12:40 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4tGS-0000mL-5B for pgsql-hackers@lists.postgresql.org; Sat, 07 Apr 2018 19:12:40 +0000 Received: from mout.gmx.net ([212.227.17.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f4tGP-0003Ef-3g for pgsql-hackers@lists.postgresql.org; Sat, 07 Apr 2018 19:12:38 +0000 Received: from ex ([80.187.122.44]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MfRnb-1epp4X0huV-00P6KP; Sat, 07 Apr 2018 21:11:50 +0200 From: Andreas Seltenreich To: Pavan Deolasee Cc: Simon Riggs , Pavel Stehule , Chapman Flack , PostgreSQL Hackers Subject: Re: [HACKERS] MERGE SQL Statement for PG11 References: <20180129154457.GC11613@momjian.us> <495e24a5-d5bf-3ef2-ccdd-dd112c1c3a15@anastigmatix.net> <87k1vtdexn.fsf@ansel.ydns.eu> <87a7wpc5n3.fsf@ansel.ydns.eu> <87371yczqk.fsf@ansel.ydns.eu> X-PGP-Key: 4096R/803D1FFF 2015-02-04 Key fingerprint = 4758 81DC 8539 494D 29B4 692D F587 0601 803D 1FFF Date: Sat, 07 Apr 2018 21:11:48 +0200 In-Reply-To: (Pavan Deolasee's message of "Tue, 27 Feb 2018 23:23:06 +0530") Message-ID: <871sfq3k7f.fsf@ansel.ydns.eu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:OuiuPHuJNBWgdyIOY/NHcBSxMsXw1bAFg7S9AGkllmbIZ93g6J4 I6lUb5NroQtE83JLilPGkVhU6d3viX4hB5iXg/crOzLAb1mmnvCU/bSjDIoO9Qso4PkRkEe MauySXsGIzcuiSvWDGRQrFOH8s/c5XZQ8lKFG8a+aPMpXtREC/a6MCYU468nWik9C+zrmeE UyWu3B64NW5mMlOW6/Ssg== X-UI-Out-Filterresults: notjunk:1;V01:K0:jHQQNo9id8Q=:WFrakAfM/btoUKgSZz6+IU mrTTlmhw2GFgEBlhbA497doB1RJP1IqfEkKAWmA4+rAFRWncx/o40yVgqE+W3rNdg2kEU2ycx 2SVkkxW0ykp+E92MjXxA9ml9GIW36LgczagIskxDAFQoUUGcynMcA58ECDV7kN4nD8MnTP1El O7xW0zwgTbhpMcrjbCSy7prQX2/6B7H7qzJTuJmUGDOwQva1f3f4y8+hlZkSs3RRJ9oawOPlj BX+Wc33w1jersuqUl1Rd/vc6ysJ0AG3KYDapI+3WlWEHgOGYZvpvienK+W+zoCEYErhMq0R0S FfhtEayoAahm3WiDw424qXrbErlNuQeacjZ/GOKKjXuaue8CZ+02QH4pCOh8m1T+B1A7d2gXA LBTXkvEnJlCW07uIp/mGDupKMUsDSJJnVzcVYYb3pTqFVblgSV9XACBwRGdujZsuZ+ya/t/jM UHju9MHXTNPgqOkSfFsbzJSFVfRZg7XzxD+xAxodP32I4LFjrLo+aVnVUwoAQv3m2tKJsy5T0 dtmHLUOm7l7UhhFFYSVGoY8mKRT1vj97CEFDbzrAnqaUJ9SfM+uaStK2Q5MDQWy3AQY6T/y2k q7ZRrFmOiAASlLvt38+lG0imardvKQ/q9PZS+gyLg92fnWa+TyYpvBzyZnXrFKsiwrlS+optE orw3l19z3oe+B/aWPTMZPgB/7e9XySXU+TH9AiSZoX05638V368WRrdw9sI3WbO2urdXrLSh3 h+kq2PSBPAtUiqdJYsDpQkBkgn3wfDIr1dEmT/vsmEKFroyP1Nk2iROWoQONgrgs/28ppN3gs tUhrvZ/AVJ8+VlAPuEVAbpeO7yzG+L706m4JLSZiYKvx83YBJI= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, sqlsmith triggered an assertion with the following MERGE statement against the regression database. Testing was done with master at 039eb6e92f. Backtrace below. regards, Andreas MERGE INTO public.pagg_tab_ml_p3 as target_0 USING public.hash_i4_heap as ref_0 ON target_0.b = ref_0.seqno WHEN MATCHED AND ((select bitcol from public.brintest limit 1 offset 92) > cast(null as "bit")) and (false) THEN UPDATE set b = target_0.b, a = target_0.b WHEN NOT MATCHED AND cast(null as text) ~ cast(nullif(case when cast(null as float8) <= cast(null as float8) then cast(null as text) else cast(null as text) end , cast(null as text)) as text) THEN DO NOTHING; #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007f25474cf42a in __GI_abort () at abort.c:89 #2 0x0000556c14b75bb3 in ExceptionalCondition ( conditionName=conditionName@entry=0x556c14d09bf8 "!(list != ((List *) ((void *)0)))", errorType=errorType@entry=0x556c14bc4dbd "FailedAssertion", fileName=fileName@entry=0x556c14d3022c "list.c", lineNumber=lineNumber@entry=390) at assert.c:54 #3 0x0000556c1495d580 in list_nth_cell (list=, n=) at list.c:390 #4 0x0000556c1495d5d6 in list_nth (list=list@entry=0x0, n=) at list.c:413 #5 0x0000556c14911fa5 in adjust_partition_tlist (tlist=0x0, map=, map=) at execPartition.c:1266 #6 0x0000556c14913049 in ExecInitPartitionInfo (mtstate=mtstate@entry=0x556c16c163e8, resultRelInfo=, proute=proute@entry=0x556c16c29988, estate=estate@entry=0x556c16c15bf8, partidx=0) at execPartition.c:683 #7 0x0000556c1490ff80 in ExecMergeMatched (junkfilter=0x556c16c15bf8, tupleid=0x7ffe8088a10a, slot=0x556c16c22e20, estate=0x556c16c15bf8, mtstate=0x556c16c163e8) at execMerge.c:205 #8 ExecMerge (mtstate=mtstate@entry=0x556c16c163e8, estate=estate@entry=0x556c16c15bf8, slot=slot@entry=0x556c16c22e20, junkfilter=junkfilter@entry=0x556c16c2b730, resultRelInfo=resultRelInfo@entry=0x556c16c15e48) at execMerge.c:127 #9 0x0000556c14933614 in ExecModifyTable (pstate=0x556c16c163e8) at nodeModifyTable.c:2179 #10 0x0000556c1490c0ca in ExecProcNode (node=0x556c16c163e8) at ../../../src/include/executor/executor.h:239 #11 ExecutePlan (execute_once=, dest=0x556c16c111b8, direction=, numberTuples=0, sendTuples=, operation=CMD_MERGE, use_parallel_mode=, planstate=0x556c16c163e8, estate=0x556c16c15bf8) at execMain.c:1729 #12 standard_ExecutorRun (queryDesc=0x556c16c1bce8, direction=, count=0, execute_once=) at execMain.c:364 #13 0x0000556c14a6ba52 in ProcessQuery (plan=, sourceText=0x556c16b2ac08 "...", params=0x0, queryEnv=0x0, dest=0x556c16c111b8, completionTag=0x7ffe8088a500 "") at pquery.c:161 #14 0x0000556c14a6bceb in PortalRunMulti (portal=portal@entry=0x556c16b96468, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=dest@entry=0x556c16c111b8, altdest=altdest@entry=0x556c16c111b8, completionTag=completionTag@entry=0x7ffe8088a500 "") at pquery.c:1291 #15 0x0000556c14a6c979 in PortalRun (portal=portal@entry=0x556c16b96468, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x556c16c111b8, altdest=altdest@entry=0x556c16c111b8, completionTag=0x7ffe8088a500 "") at pquery.c:804 #16 0x0000556c14a6859b in exec_simple_query ( query_string=0x556c16b2ac08 "MERGE INTO public.pagg_tab_ml_p3 as target_0\nUSING public.hash_i4_heap as ref_0\nON target_0.b = ref_0.seqno\nWHEN MATCHED AND ((select bitcol from public.brintest limit 1 offset 92)\n > cast(null as \"bi"...) at postgres.c:1121 #17 0x0000556c14a6a341 in PostgresMain (argc=, argv=argv@entry=0x556c16b56ad8, dbname=, username=) at postgres.c:4149 #18 0x0000556c1474eac4 in BackendRun (port=0x556c16b4c030) at postmaster.c:4409 #19 BackendStartup (port=0x556c16b4c030) at postmaster.c:4081 #20 ServerLoop () at postmaster.c:1754 #21 0x0000556c149ec017 in PostmasterMain (argc=3, argv=0x556c16b257d0) at postmaster.c:1362 #22 0x0000556c1475006d in main (argc=3, argv=0x556c16b257d0) at main.c:228