Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ncnxp-000799-1l for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Apr 2022 12:43:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ncnxn-0007bH-Vb for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Apr 2022 12:43:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ncnxn-0007b8-LZ for pgsql-hackers@lists.postgresql.org; Fri, 08 Apr 2022 12:43:43 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ncnxk-0001mA-RG for pgsql-hackers@lists.postgresql.org; Fri, 08 Apr 2022 12:43:42 +0000 Received: by mail-io1-xd30.google.com with SMTP id q11so10400576iod.6 for ; Fri, 08 Apr 2022 05:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yG0cDdSqZIYkR+8//98T11VC6WpX/ITiaoaYnYP1H1w=; b=udfpNANoNoz6GgzTFkF1JqJhFIAqkFHaFyqED3WhdiRMAYjz7U7ilJqlHcsACtkZ/L lZUS2FC7h5tXZxwjpuGpHnOB1hS1E3hbkVfmZRsKZ5iFjmHcrvMHouVYaqoJg8N7c6yJ w8ftNaVz07iXL7KvkrWR5z52CDwipLpPPT40z3e83IMAHBYLVZ88H2LsLUUnC1gABUSy sX/XvjvfnmpoQ1rtzu0ryuSrwY1PdW5qKEgYAkStpQJIU89oDMaTzMmTYACqAFc5YSQS AQc2S4FQntgIY85MgoPoVq2w/MWDPKoHGweZzzo+TOMHUg2ec+xImfFonrr3f92YRitg 6B1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yG0cDdSqZIYkR+8//98T11VC6WpX/ITiaoaYnYP1H1w=; b=pLx3dUq917CnSkzlXYUsSti/M3QXROVS9z3m04qe4vt7oSzDvMJn4z0Gbx/txCHx+a tj7dWnEvJnoRfuh17ZTAUMRpkvqb7zhhnQ9j0NYTJfA7meRs3Db+jSV9VhOWwUPB746i Z4ClnGRY8o2ZHA9FZM13p5AAtj6Ez8j8xSsLZ1ln+VL3a8ZEmBFvdB+5HPkUn2KQLoyI ptCufYFAFvhj+/q0S9PeKN1vYIU/245GoY/7SxQ7HFQnTbvBamWDhXNNXxqtNofzbqQX frEK+3Jh1Cg9wSCu/SpbNFrcon2dlRyPOIewmCJT0nouqegGaTIZ9l2kred2rfj6/v8V WsmQ== X-Gm-Message-State: AOAM532tT5Sf3awen8oFAavBcoozSbslHSp/+kDHP1QKO3DvgMMNbIB6 WlWnn889eGV8K38XFGyINmxZeg== X-Google-Smtp-Source: ABdhPJyn53SyHE0eCL6j84G7RQ2ZN7fa2boF6QdszDSdoZMHwNBIUds2ELfZV/tc5I5gKHwr7+IW2Q== X-Received: by 2002:a05:6638:379e:b0:321:5f2c:ca0f with SMTP id w30-20020a056638379e00b003215f2cca0fmr8802508jal.17.1649421820146; Fri, 08 Apr 2022 05:43:40 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k6-20020a6b4006000000b00649d7111ebasm14914743ioa.0.2022.04.08.05.43.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2022 05:43:39 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id CAB67800E4F; Fri, 8 Apr 2022 07:43:38 -0500 (CDT) Date: Fri, 8 Apr 2022 07:43:38 -0500 From: Justin Pryzby To: Etsuro Fujita Cc: Zhihong Yu , Alexander Pyhalov , "Andrey V. Lepikhov" , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Subject: Re: Defer selection of asynchronous subplans until the executor initialization stage Message-ID: <20220408124338.GK24419@telsasoft.com> References: <8891e9b4-040f-6d71-fa63-3069046dfb3d@postgrespro.ru> <932e6ed12832831592d01a3b06c16d63@postgrespro.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 06, 2022 at 03:58:29PM +0900, Etsuro Fujita wrote: > I have committed the patch after modifying it as such. (I think we > can improve these later, if necessary.) This patch seems to be causing the planner to crash. Here's a query reduced from sqlsmith. | explain SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 <= pg_trigger_depth(); Program terminated with signal SIGSEGV, Segmentation fault. #0 0x000055b4396a2edf in trivial_subqueryscan (plan=0x7f4219ed93b0) at ../../../../src/include/nodes/pg_list.h:151 151 return l ? l->length : 0; (gdb) bt #0 0x000055b4396a2edf in trivial_subqueryscan (plan=0x7f4219ed93b0) at ../../../../src/include/nodes/pg_list.h:151 #1 0x000055b43968af89 in mark_async_capable_plan (plan=plan@entry=0x7f4219ed93b0, path=path@entry=0x7f4219e89538) at createplan.c:1132 #2 0x000055b439691924 in create_append_plan (root=root@entry=0x55b43affb2b0, best_path=best_path@entry=0x7f4219ed0cb8, flags=flags@entry=0) at createplan.c:1329 #3 0x000055b43968fa21 in create_plan_recurse (root=root@entry=0x55b43affb2b0, best_path=best_path@entry=0x7f4219ed0cb8, flags=flags@entry=0) at createplan.c:421 #4 0x000055b43968f974 in create_projection_plan (root=root@entry=0x55b43affb2b0, best_path=best_path@entry=0x7f4219ed0f60, flags=flags@entry=1) at createplan.c:2039 #5 0x000055b43968fa6f in create_plan_recurse (root=root@entry=0x55b43affb2b0, best_path=0x7f4219ed0f60, flags=flags@entry=1) at createplan.c:433 #6 0x000055b439690221 in create_plan (root=root@entry=0x55b43affb2b0, best_path=) at createplan.c:348 #7 0x000055b4396a1451 in standard_planner (parse=0x55b43af05e28, query_string=, cursorOptions=2048, boundParams=0x0) at planner.c:413 #8 0x000055b4396a19c1 in planner (parse=parse@entry=0x55b43af05e28, query_string=query_string@entry=0x55b43af04c40 "SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 > pg_trigger_depth();", cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry=0x0) at planner.c:277 #9 0x000055b439790c78 in pg_plan_query (querytree=querytree@entry=0x55b43af05e28, query_string=query_string@entry=0x55b43af04c40 "SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 > pg_trigger_depth();", cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry=0x0) at postgres.c:883 #10 0x000055b439790d54 in pg_plan_queries (querytrees=0x55b43afdd528, query_string=query_string@entry=0x55b43af04c40 "SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 > pg_trigger_depth();", cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry=0x0) at postgres.c:975 #11 0x000055b439791239 in exec_simple_query (query_string=query_string@entry=0x55b43af04c40 "SELECT 1 FROM information_schema.constraint_column_usage WHERE 1 > pg_trigger_depth();") at postgres.c:1169 #12 0x000055b439793183 in PostgresMain (dbname=, username=) at postgres.c:4542 #13 0x000055b4396e6af7 in BackendRun (port=port@entry=0x55b43af2ffe0) at postmaster.c:4489 #14 0x000055b4396e9c03 in BackendStartup (port=port@entry=0x55b43af2ffe0) at postmaster.c:4217 #15 0x000055b4396e9e4a in ServerLoop () at postmaster.c:1791 #16 0x000055b4396eb401 in PostmasterMain (argc=7, argv=) at postmaster.c:1463 #17 0x000055b43962b4df in main (argc=7, argv=0x55b43aeff0c0) at main.c:202 Actually, the original query failed like this: #2 0x000055b4398e9f90 in ExceptionalCondition (conditionName=conditionName@entry=0x55b439a61238 "plan->scanstatus == SUBQUERY_SCAN_UNKNOWN", errorType=errorType@entry=0x55b43994b00b "FailedAssertion", #3 0x000055b4396a2ecf in trivial_subqueryscan (plan=0x55b43b59cac8) at setrefs.c:1367