Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvGhF-0002a6-QO for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Aug 2019 07:49:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hvGhD-0006Vh-Pz for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Aug 2019 07:49:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvGhD-0006VL-7Q for pgsql-hackers@lists.postgresql.org; Wed, 07 Aug 2019 07:49:19 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1hvGh9-0002vV-W6 for pgsql-hackers@postgresql.org; Wed, 07 Aug 2019 07:49:18 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 7680721C401B; Wed, 7 Aug 2019 10:49:13 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (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 0089921C4029; Wed, 7 Aug 2019 10:49:12 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1565164153; bh=i6Xno1iYR2fkbWLP2U/RF1I6TczBeuLyCmYaZsRvW+Y=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=etbZzgNvkVxkU0G6+WCius5eiXF+P9KbUjo3PiyjVcz5J1CfaNFagVGkmjkkwDgeA cyJ7TzVTUHziXeo8IpuQjs+/5Wpf18zkAonI4W1bLN79qTLdXr5/JFxJ8W6m2Tdvmq 8nze869ooqr1Xo6nEzTL/4hES9fVArHgTqZ6XOfA= Subject: Re: Built-in connection pooler To: Li Japin Cc: "pgsql-hackers@postgresql.org" References: <139e59f5-15bc-13ff-58e2-7a2229041236@postgrespro.ru> <78d43611-668e-a4e2-4796-dbffccc2512d@postgrespro.ru> <42c78b0e-e2ad-7920-3b31-37a81c9ba83b@postgrespro.ru> <9ba4e22d-2eac-5ffe-a9c4-19cb698d2af8@postgrespro.ru> <52654ab5-c60c-9c00-0d21-bb3176001668@ww-it.cn> From: Konstantin Knizhnik Message-ID: <74bb4ce5-45bc-fcd9-a1ef-0194a12df8bd@postgrespro.ru> Date: Wed, 7 Aug 2019 10:49:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, Li Thank you very much for reporting the problem. On 07.08.2019 7:21, Li Japin wrote: > I inspect the code, and find the following code in DefineRelation function: > > if (stmt->relation->relpersistence != RELPERSISTENCE_TEMP >         && stmt->oncommit != ONCOMMIT_DROP) >         MyProc->is_tainted = true; > > For temporary table, MyProc->is_tainted might be true, I changed it as > following: > > if (stmt->relation->relpersistence == RELPERSISTENCE_TEMP >         || stmt->oncommit == ONCOMMIT_DROP) >         MyProc->is_tainted = true; > > For temporary table, it works. I not sure the changes is right. Sorry, it is really a bug. My intention was to mark backend as tainted if it is creating temporary table without ON COMMIT DROP clause (in the last case temporary table will be local to transaction and so cause no problems with pooler). Th right condition is:     if (stmt->relation->relpersistence == RELPERSISTENCE_TEMP         && stmt->oncommit != ONCOMMIT_DROP)         MyProc->is_tainted = true; -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company