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 1ndjzP-0001UK-7m for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Apr 2022 02:41:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ndjzM-0007C2-UO for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Apr 2022 02:41:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ndjzM-0007Bs-Li for pgsql-hackers@lists.postgresql.org; Mon, 11 Apr 2022 02:41:12 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ndjzF-0004BE-Ij for pgsql-hackers@lists.postgresql.org; Mon, 11 Apr 2022 02:41:11 +0000 Received: by mail-io1-xd2d.google.com with SMTP id y65so538411iof.1 for ; Sun, 10 Apr 2022 19:41:05 -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:mime-version:content-disposition :in-reply-to:user-agent; bh=IMsHvyO+RtqXj3DRh4l9WztIihC5jGhXR1rRXEEeL2c=; b=aAe0Y3CoaoyHnNF7H6JEObIEyh0oOMGtFqsOHChk4xXWqLuZDeNITm5SblldO45YEU rmHVS1SazEYAFv7N9yj1+HOLCZ7+PqaGptcmMgqXib3AEJDY6tLbEjK8FM+uj6lcCxXV XqHF+vXEGFau/tb4Dvk4gh/mem+vBkSE3pfcwKgts0AhruTmyCEMui2Yeqskv8HTnpIZ +KDV9jZTa2bSZfgsgxOyMLGyKvGzetT9CzR2yRm8A1a70kMaZ+0zwNybMFKvpbqtATo1 JaEs0su1PEchIr1XW5Pva/wTJI4+mpCdqkWLqhyCzPK3JmhboidwDSseHV3zfduChmgr m3hA== 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:mime-version :content-disposition:in-reply-to:user-agent; bh=IMsHvyO+RtqXj3DRh4l9WztIihC5jGhXR1rRXEEeL2c=; b=4DHtUWYMmyvxNJDbPJDvluyoZvyuicdxPqcS4YFQmnriNglEOQJSqDYJ4YZI9WEj/3 +c2bMTxE/gcljmAFIMFKypJKGM/dTUco1UG+dRT03912xJTwyBFRV1ij4UB60nxnhP7q 5/9IMQrC/nP8wZyJBRmmWkp2q3AaOxcXxlCNcUNCXmL7CquNgZm6ihVcO4+S5Q1AcleU DTN42aZT6+aR29tFn5tW2buCNx8yM0EaoqMmHJ/x9P38C8ZNlFBW9z8acah1GvOIflZM kgTnobYxhgYXGmniqGziSxqxU1GeXMw1CNu6BMxw3xcYKoAFVJtQDIRg/ZjqQSHOH6F2 mgQw== X-Gm-Message-State: AOAM530cfV75NUXnCPz5nLJaQmsLpery7uGl/tYTY8jzHkwHDt03/DWQ 3Itb2JdXaLlvFLopZcmBO9YKGA== X-Google-Smtp-Source: ABdhPJwA1v7KqTfJVv9LyzRH8c+GTCy2xGQYYfPuFv37NKol9Ibd1BWnxbueErrrSNksDTPj+r5u5Q== X-Received: by 2002:a02:ccaf:0:b0:325:e1e5:1748 with SMTP id t15-20020a02ccaf000000b00325e1e51748mr6510538jap.34.1649644863164; Sun, 10 Apr 2022 19:41:03 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id m4-20020a0566022e8400b006463059bf2fsm19721239iow.49.2022.04.10.19.41.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Apr 2022 19:41:02 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id A0032800C97; Sun, 10 Apr 2022 21:41:01 -0500 (CDT) Date: Sun, 10 Apr 2022 21:41:01 -0500 From: Justin Pryzby To: Etsuro Fujita , Zhihong Yu Cc: 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: <20220411024101.GC26620@telsasoft.com> 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 Sun, Apr 10, 2022 at 07:43:48PM +0900, Etsuro Fujita wrote: > On Sat, Apr 9, 2022 at 1:58 AM Etsuro Fujita wrote: > > On Fri, Apr 8, 2022 at 9:43 PM Justin Pryzby wrote: > > > 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. > > > > Reproduced. Will look into this. > > I think the cause of this is that mark_async_capable_plan() failed to > take into account that when the given path is a SubqueryScanPath or > ForeignPath, the given corresponding plan might include a gating > Result node that evaluates pseudoconstant quals. My oversight. :-( > Attached is a patch for fixing that. I think v14 has the same issue, > so I think we need backpatching. Thanks - this seems to resolve the issue. On Sun, Apr 10, 2022 at 06:46:25AM -0700, Zhihong Yu wrote: > Looking at the second hunk of the patch: > FdwRoutine *fdwroutine = path->parent->fdwroutine; > ... > + if (IsA(plan, Result)) > + return false; > > It seems the check of whether plan is a Result node can be lifted ahead of > the switch statement (i.e. to the beginning of mark_async_capable_plan). > > This way, we don't have to check for every case in the switch statement. I think you misread it - the other branch says: if (*not* IsA()) -- Justin