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 1m1P3j-0004og-Hr for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Jul 2021 08:06:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m1P3i-0000xY-Dc for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Jul 2021 08:06:58 +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 1m1P3i-0000uW-2H for pgsql-bugs@lists.postgresql.org; Thu, 08 Jul 2021 08:06:58 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m1P3f-0003TJ-82 for pgsql-bugs@lists.postgresql.org; Thu, 08 Jul 2021 08:06:57 +0000 Received: from Andreys-MacBook-Pro.local (unknown [88.135.91.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id E55F221C8CD9; Thu, 8 Jul 2021 11:06:51 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1625731612; bh=K+Z7dZZXZflg2QzM/CW6vTkdlcyVBferP0WVNAiSsUo=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=qJxDMsd6Rtuob3l/JDJqxJe6zj104xuAoUuIwQ+vqGG2kSlJI0N7jt+3UTILnPmlq qcugi0Wekqy257WWOyAJEmonaYY92nJxzkP4vaFJr5jD0gF++5IMtWRo8NdEDFncTc 2FnpvXi3FCee+9GDsCc+9tfueoNLWtnelT3M/sHI= Subject: Re: The case when AsyncAppend exists also in the qual of Async ForeignScan To: Etsuro Fujita Cc: PostgreSQL mailing lists References: From: Andrey Lepikhov Organization: Postgres Professional Message-ID: <9b656dd9-62dc-bd61-ceae-5333cec2a966@postgrespro.ru> Date: Thu, 8 Jul 2021 11:06:46 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/7/21 10:49, Etsuro Fujita wrote: > On Sat, Jul 3, 2021 at 8:35 AM Etsuro Fujita wrote: >> On Fri, Jul 2, 2021 at 10:24 PM Andrey Lepikhov >> wrote: >>> I found one bug. Look at the case: >>> >>> CREATE TABLE test (x int) PARTITION BY HASH (x); >>> CREATE TABLE test_1 (x int); >>> CREATE TABLE test_2 (x int); >>> CREATE FOREIGN TABLE ftest_1 PARTITION OF test >>> FOR VALUES WITH (modulus 2, remainder 0) >>> SERVER loopback OPTIONS (table_name 'test_1'); >>> CREATE FOREIGN TABLE ftest_2 PARTITION OF test >>> FOR VALUES WITH (modulus 2, remainder 1) >>> SERVER loopback2 OPTIONS (table_name 'test_2'); >>> INSERT INTO test (SELECT * FROM generate_series(1,10)); >>> ANALYZE test,test_1,test_2,ftest_1,ftest_2; >>> >>> EXPLAIN (ANALYZE) >>> SELECT * FROM test WHERE x NOT IN ( >>> SELECT avg(x) FROM test WHERE x > 10 >>> ); >>> ERROR: InstrEndLoop called on running node >>> >>> When I added ', COSTS OFF, SUMMARY OFF, TIMING OFF' this example fall >>> down into the SEGFAULT. >>> >>> I prepared quick fix for this problem (see patch in attachment). Maybe >>> it is'nt a best solution but it can speedup search of it. >> >> I’ll looking into this. Thanks for the report and patch! > > I tried to reproduce this in my environment using HEAD and PG14, but I > couldn't. Could you elaborate a bit more on how to reproduce this? > > Best regards, > Etsuro Fujita > Initially I cought this bug during TPC-H benchmarking, query Q16, right after start of execution. Key thing here is using a hashed subplan. -- regards, Andrey Lepikhov Postgres Professional