Open
Description
CREATE TABLE update_test (
a INT DEFAULT 10,
b INT,
c TEXT
);
SELECT create_reference_table('update_test');
UPDATE update_test
SET (b,a) = (select a,b from update_test where b = 41 and c = 'car')
WHERE a = 100 AND b = 20;
Above update crashes due to assertion failure with below backtrace:
#2 0x0000000000aae380 in ExceptionalCondition (conditionName=0x7f5ffa87d4b8 "!(((Param *) expr)->paramid == ((cur_ma_sublink->subLinkId << 16) | 1))",
errorType=0x7f5ffa87ca81 "FailedAssertion", fileName=0x7f5ffa87caf1 "deparser/ruleutils_12.c", lineNumber=3411) at assert.c:54
#3 0x00007f5ffa7d1572 in get_update_query_targetlist_def (query=0x1ded318, targetList=0x1dee078, context=0x7ffeb0977d90, rte=0x1ded490)
at deparser/ruleutils_12.c:3410
#4 0x00007f5ffa7d11c1 in get_update_query_def (query=0x1ded318, context=0x7ffeb0977d90) at deparser/ruleutils_12.c:3277
#5 0x00007f5ffa7ce668 in get_query_def_extended (query=0x1ded318, buf=0x1df0198, parentnamespace=0x0, distrelid=0, shardid=0, resultDesc=0x0,
prettyFlags=0, wrapColumn=0, startIndent=0) at deparser/ruleutils_12.c:1968
#6 0x00007f5ffa7ce48c in get_query_def (query=0x1ded318, buf=0x1df0198, parentnamespace=0x0, resultDesc=0x0, prettyFlags=0, wrapColumn=0, startIndent=0)
at deparser/ruleutils_12.c:1907
#7 0x00007f5ffa7cb2d4 in pg_get_query_def (query=0x1ded318, buffer=0x1df0198) at deparser/ruleutils_12.c:457
#8 0x00007f5ffa8099db in DeparseTaskQuery (task=0x1ded1e0, query=0x1ded318) at planner/deparse_shard_query.c:499
#9 0x00007f5ffa809b20 in TaskQueryString (task=0x1ded1e0) at planner/deparse_shard_query.c:564
#10 0x00007f5ffa7e833d in ExecuteLocalTaskListExtended (taskList=0x1deffe8, orig_paramListInfo=0x0, distributedPlan=0x1deafe8, defaultTupleDest=0x1defd78,
isUtilityCommand=false) at executor/local_executor.c:281
#11 0x00007f5ffa7dcd23 in RunLocalExecution (scanState=0x1ddcb10, execution=0x1defdb0) at executor/adaptive_executor.c:825
#12 0x00007f5ffa7dcb52 in AdaptiveExecutor (scanState=0x1ddcb10) at executor/adaptive_executor.c:751
#13 0x00007f5ffa7e1f53 in CitusExecScan (node=0x1ddcb10) at executor/citus_custom_scan.c:224
#14 0x0000000000732cc9 in ExecCustomScan (pstate=0x1ddcb10) at nodeCustom.c:116
#15 0x000000000071a5d6 in ExecProcNodeFirst (node=0x1ddcb10) at execProcnode.c:445
#16 0x000000000070f414 in ExecProcNode (node=0x1ddcb10) at ../../../src/include/executor/executor.h:239
#17 0x0000000000711c4f in ExecutePlan (estate=0x1ddc888, planstate=0x1ddcb10, use_parallel_mode=false, operation=CMD_UPDATE, sendTuples=false,
numberTuples=0, direction=ForwardScanDirection, dest=0x1dc1d58, execute_once=true) at execMain.c:1646
#18 0x000000000070fa51 in standard_ExecutorRun (queryDesc=0x1ddc478, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:364
#19 0x00007f5ffa7ea6e7 in CitusExecutorRun (queryDesc=0x1ddc478, direction=ForwardScanDirection, count=0, execute_once=true)
at executor/multi_executor.c:202
#20 0x000000000070f874 in ExecutorRun (queryDesc=0x1ddc478, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:306
#21 0x0000000000923abc in ProcessQuery (plan=0x1dc1cc0,
sourceText=0x1c1fae8 "UPDATE update_test\nSET (b,a) = (select a,b from update_test where b = 41 and c = 'car')\nWHERE a = 100 AND b = 20;", params=0x0,
queryEnv=0x0, dest=0x1dc1d58, completionTag=0x7ffeb0978690 "") at pquery.c:161
#22 0x00000000009254f0 in PortalRunMulti (portal=0x1cf87d8, isTopLevel=true, setHoldSnapshot=false, dest=0x1dc1d58, altdest=0x1dc1d58,
completionTag=0x7ffeb0978690 "") at pquery.c:1283
#23 0x0000000000924a4d in PortalRun (portal=0x1cf87d8, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x1dc1d58, altdest=0x1dc1d58,
completionTag=0x7ffeb0978690 "") at pquery.c:796
#24 0x000000000091e5b4 in exec_simple_query (
query_string=0x1c1fae8 "UPDATE update_test\nSET (b,a) = (select a,b from update_test where b = 41 and c = 'car')\nWHERE a = 100 AND b = 20;")
at postgres.c:1215
#25 0x0000000000922a7c in PostgresMain (argc=1, argv=0x1cb9020, dbname=0x1cb8e60 "postgres", username=0x1cb8e38 "postgres") at postgres.c:4247
#26 0x00000000008713bd in BackendRun (port=0x1c3b9f0) at postmaster.c:4448
#27 0x0000000000870b06 in BackendStartup (port=0x1c3b9f0) at postmaster.c:4139
#28 0x000000000086cc46 in ServerLoop () at postmaster.c:1704
#29 0x000000000086c46d in PostmasterMain (argc=3, argv=0x1c1a760) at postmaster.c:1377
#30 0x00000000007850f7 in main (argc=3, argv=0x1c1a760) at main.c:228
And if we disable assertions, we get no errors nor warnings.