Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cRKNF-0007bC-2G for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Jan 2017 14:59:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cRKNE-0006Dn-KG for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Jan 2017 14:59:36 +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.84_2) (envelope-from ) id 1cRKMZ-0005Ts-Pf for pgsql-bugs@postgresql.org; Wed, 11 Jan 2017 14:58:55 +0000 Received: from webmail.agama.tv ([194.68.222.217]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cRKMW-00009g-Dk for pgsql-bugs@postgresql.org; Wed, 11 Jan 2017 14:58:54 +0000 Received: from ro-laptop.office.internal (213.115.244.81) by agamasmex01.int.agama.se (192.168.42.2) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.544.27; Wed, 11 Jan 2017 15:59:32 +0100 Reply-To: Ragnar Ouchterlony Subject: Re: Problem with declarative partitioning and COPY FROM References: <16d73804-c9cd-14c5-463e-5caad563ff77@agama.tv> To: Amit Langote CC: From: Ragnar Ouchterlony Organization: Agama Technologies AB Message-ID: <732dfc84-25f5-413c-1eee-0bfa7a370093@agama.tv> Date: Wed, 11 Jan 2017 15:58:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [213.115.244.81] X-ClientProxiedBy: agamasmex01.int.agama.se (192.168.42.2) To agamasmex01.int.agama.se (192.168.42.2) X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2017-01-11 13:24, Amit Langote wrote: > There's a bug and has been reported on the -hackers mailing list as > well. Please try your example after applying the patch 0002 attached > with the following email: > https://www.postgresql.org/message-id/01bc4745-bac8-a033-96a1-8a42b45d2fc1%40lab.ntt.co.jp Ok, that is good! I tested the patch as is, but it did not make a difference. Then I read the patch more carefully. + /* + * FIXME: We don't engage the bulk-insert mode for partitioned tables, + * because the the heap relation is most likely change from one row to + * next due to tuple-routing. + */ + if (cstate->rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) + bistate = GetBulkInsertState(); The if-statement does not match how I read the comment. That is, shouldn't it be "!=" rather than "=="? I have tested using that change and now I get the results I expect. /Ragnar Ouchterlony, Agama Technologies -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs