Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cxjFD-0000rf-8s for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Apr 2017 00:01:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cxjFC-0000fI-Or for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Apr 2017 00:01:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cxjDh-0006GO-Hg for pgsql-hackers@postgresql.org; Mon, 10 Apr 2017 23:59:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cxjDe-0007ZK-Gt for pgsql-hackers@postgresql.org; Mon, 10 Apr 2017 23:59:41 +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 v3ANxVuk023398; Mon, 10 Apr 2017 19:59:31 -0400 From: Tom Lane To: Andreas Seltenreich cc: pgsql-hackers@postgresql.org, Robert Haas Subject: Re: [sqlsmith] ERROR: badly formatted node string "RESTRICTINFO... In-reply-to: <9631.1491863013@sss.pgh.pa.us> References: <87tw5x4vcu.fsf@credativ.de> <11668.1491753112@sss.pgh.pa.us> <9631.1491863013@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 10 Apr 2017 18:23:33 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23396.1491868771.1@sss.pgh.pa.us> Date: Mon, 10 Apr 2017 19:59:31 -0400 Message-ID: <23397.1491868771@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org I wrote: > (BTW, I've not yet looked to see if this needs to be back-ported.) postgres_fdw will definitely include RestrictInfos in its fdw_private list in 9.6. However, I've been unable to provoke a visible failure. After some rooting around, the reason seems to be that: 1. postgres_fdw doesn't mark its plans as parallel-safe --- it doesn't even have a IsForeignScanParallelSafe method. So you'd think that one of its plans could never be transmitted to a parallel worker ... but: 2. Andreas' test query doesn't have the foreign scan in the main query tree, it's in an InitPlan. 9.6 did not transmit any subplans or initplans to parallel workers, but HEAD does. So HEAD sends the illegal structure to the worker which spits up on trying to read a RestrictInfo. I think the fact that we see this problem at all may indicate an oversight in commit 5e6d8d2bbbcace304450b309e79366c0da4063e4 ("Allow parallel workers to execute subplans"). If the worker were to actually run the initplan, bad things would happen (the worker would create its own remote connection, which we don't want). Now, in the problem plan the InitPlan is actually attached to the topmost Gather, which I think is safe because it'll be run by the master, but I wonder if we're being careful enough about non-parallel-safe plans for initplans/subplans. I do not think the planner tracks the locations of references to initplan outputs carefully enough to be very sure about what it's doing here. Also, even if the worker never actually executes the plan node, just doing ExecInitNode on it in a parallel worker might be more than a non-parallel-safe FDW is prepared to cope with. Anyway, at present it doesn't look like we need this patch in 9.6. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers