Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gC5cv-0005hd-Lw for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Oct 2018 16:21:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gC5cs-0002ty-BM for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Oct 2018 16:21:50 +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 1gC5cs-0002tq-21 for pgsql-bugs@lists.postgresql.org; Mon, 15 Oct 2018 16:21:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gC5cn-0003iF-QV for pgsql-bugs@lists.postgresql.org; Mon, 15 Oct 2018 16:21:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w9FGLfBf001317; Mon, 15 Oct 2018 12:21:41 -0400 From: Tom Lane To: mborch@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15428: "Inception" with recursive prepared statement causes infinite loop In-reply-to: <15428-b3c2915ec470b033@postgresql.org> References: <15428-b3c2915ec470b033@postgresql.org> Comments: In-reply-to =?utf-8?q?PG_Bug_reporting_form?= message dated "Fri, 12 Oct 2018 09:00:12 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1315.1539620501.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 15 Oct 2018 12:21:41 -0400 Message-ID: <1316.1539620501@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > Using the extended query message flow, I prepare, bind and execute a que= ry > as a named statement. > If I repeat this again with the query "execute " =E2=80=93 the bac= kend crashes > with a segmentation fault due to an infinite recursion (see excerpt > below). Hm, yeah. I'm inclined to think that the right fix is a check_stack_depth() call in standard_ProcessUtility. That transforms the case into $ ./test PQexecPrepared failed: ERROR: stack depth limit exceeded HINT: Increase the configuration parameter "max_stack_depth" (currently 2= 048kB), after ensuring the platform's stack depth limit is adequate. which seems like an adequate response, and would cover some related scenarios as well. regards, tom lane