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 1mNRyw-00078v-Jt for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Sep 2021 03:41:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mNRyv-0001uu-J9 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Sep 2021 03:41:09 +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 1mNRyv-0001um-Bh for pgsql-hackers@lists.postgresql.org; Tue, 07 Sep 2021 03:41:09 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNRys-0002dp-KX for pgsql-hackers@postgresql.org; Tue, 07 Sep 2021 03:41:09 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 22E6160794 for ; Tue, 7 Sep 2021 12:41:02 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.3 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 07 Sep 2021 12:41:02 +0900 From: torikoshia To: Pgsql Hackers Subject: EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST fails User-Agent: Roundcube Webmail/1.4.11 Message-ID: <5bafa66ad529e11860339565c9e7c166@oss.nttdata.com> X-Sender: torikoshia@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, While working on [1], we found that EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST ends up ERROR. This can be reproduced at the current HEAD(4c3478859b7359912d7): =# create table graph0( f int, t int, label text); CREATE TABLE =# insert into graph0 values (1, 2, 'arc 1 -> 2'),(1, 3, 'arc 1 -> 3'),(2, 3, 'arc 2 -> 3'),(1, 4, 'arc 1 -> 4'),(4, 5, 'arc 4 -> 5'); INSERT 0 5 =# explain(verbose) with recursive search_graph(f, t, label) as ( select * from graph0 g union all select g.* from graph0 g, search_graph sg where g.f = sg.t ) search breadth first by f, t set seq select * from search_graph order by seq; ERROR: failed to find plan for CTE sg Is this a bug? [1] https://www.postgresql.org/message-id/flat/cf8501bcd95ba4d727cbba886ba9eea8@oss.nttdata.com Regards, -- Atsushi Torikoshi NTT DATA CORPORATION