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 1lHY5S-0001gk-02 for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Mar 2021 20:27:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lHY5Q-00032L-Ln for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Mar 2021 20:27:12 +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 1lHY5Q-00032E-8r for pgsql-hackers@lists.postgresql.org; Wed, 03 Mar 2021 20:27:12 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lHY5M-0002D4-Nf for pgsql-hackers@postgresql.org; Wed, 03 Mar 2021 20:27:11 +0000 Received: by mail-qk1-x72d.google.com with SMTP id d20so24475609qkc.2 for ; Wed, 03 Mar 2021 12:27:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=p/Tee9AhkwrmrSjbUJbEOAkcGUmyEqKPC4qrfNweWCc=; b=iXjoqiS531rpaiiFpcFRGtqXnA0BoST+DiC6sBBeEwf6q9djEeabMKKJPgY9y9KuBK 1EAu51QQOrJAnhJuxQtbLpkwqGwmlJHO1zim1+fljych/YQ/Kbp6IkwLx1U+2WzQn5qd oj1T5xpxJynZgfgBSTNWYEu2Rx/E77d+TjYJgbYCRLWaqol/NkqI1shxV7TUqmoQYKMM xqsOB1vGpn3kjNW9PJjUtTRGEZvqL6P3zqcAjMaxd3QH1KaWF0GWOmmLlZ9T+f4TwYln fHeqQxY2T04gK1liKkCQBpafLPVY3WJeMPCBb7ujQ0TIEJUlKKhC4VRt/4SeWH4g4jFx s/0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=p/Tee9AhkwrmrSjbUJbEOAkcGUmyEqKPC4qrfNweWCc=; b=RHw8EqfStVxinzFoXxasveZxs/jB9p90iOVMF2aXdiQ1v1DtrbxefshXyYtj4GHfOp iqyxSbFVGIFQk/A27bUiuVbRH/Shf6N0r9frwpiwlJ/GvIZes2nsp5iWfhHuFnlsV9d9 0rCB/f8z4orwV4qeqkbVeJ9BdhHIRrs2u40CTsSLS7h4mk7h2vlr8gazMYGMKXjPAp7X 2NgSRX8tA0sl1WGTVW+6K0cNtDUNc9XeZMSwlw4gvrcL9BMeZ2WAHL5KhKTsImn6N5NK Mk+XrJkPwJB+irmMih7vhxm8q6zZyplQB7HBgIqYZzc5PxCq+hCOrfAB9R6h9ogJbBvl bFiQ== X-Gm-Message-State: AOAM530NgFOHlJnDnWNabp4jxMBDpOMExjpMtMgV5+HZxzvDz8qNvjDV QKJLfiY4oU4ULi0m7cZAf5L7JA== X-Google-Smtp-Source: ABdhPJwodY89b8SO5YvazIjRbDCWNrXEmagCiYu+rMkLSDSLWmeeVNEgZyo3gJ/DxC9Q31wx1DLxjA== X-Received: by 2002:a05:620a:c0e:: with SMTP id l14mr760470qki.91.1614803226096; Wed, 03 Mar 2021 12:27:06 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id a19sm6997443qkl.126.2021.03.03.12.27.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Mar 2021 12:27:05 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id AF64F8015F3; Wed, 3 Mar 2021 14:27:03 -0600 (CST) Date: Wed, 3 Mar 2021 14:27:03 -0600 From: Justin Pryzby To: "tsunakawa.takay@fujitsu.com" Cc: Amit Langote , Andrey Lepikhov , tanghy.fnst@cn.fujitsu.com, Alexey Kondratov , Michael Paquier , Ashutosh Bapat , Ashutosh Bapat , Etsuro Fujita , PostgreSQL-Dev , Tomas Vondra , houzj.fnst@cn.fujitsu.com Subject: Re: [POC] Fast COPY FROM command for the table with foreign partitions Message-ID: <20210303202703.GI29832@telsasoft.com> References: <6160196a-88a4-ded8-1047-cec16537a111@postgrespro.ru> <95b3e446-92ec-f01f-2035-5f5509e6e016@postgrespro.ru> <20210214210338.GN1793@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Find attached some language fixes. |/* Do this to ensure we've pumped libpq back to idle state */ I don't know why you mean by "pumped"? The CopySendEndOfRow "case COPY_CALLBACK:" should have a "break;" This touches some of the same parts as my "bulk insert" patch: https://commitfest.postgresql.org/32/2553/ -- Justin --TB36FDmn/VVEgNH/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-language-fixen.pxtch" From f7bb368963f5808bc5126f179b78507ca52b9cd2 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Wed, 24 Feb 2021 02:23:17 -0600 Subject: [PATCH] language fixen --- contrib/postgres_fdw/postgres_fdw.c | 4 ++-- doc/src/sgml/fdwhandler.sgml | 13 +++++++------ src/backend/commands/copyfrom.c | 2 +- src/backend/commands/copyto.c | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index b55f19b193..a3c394360e 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -2203,7 +2203,7 @@ pgfdw_copy_dest_cb(void *buf, int len) /* * postgresBeginForeignCopy - * Begin an COPY operation on a foreign table + * Begin a COPY operation on a foreign table */ static void postgresBeginForeignCopy(EState *estate, @@ -2306,7 +2306,7 @@ postgresExecForeignCopy(ResultRelInfo *resultRelInfo, /* * postgresEndForeignCopy - * Finish an COPY operation on a foreign table + * Finish a COPY operation on a foreign table */ static void postgresEndForeignCopy(EState *estate, ResultRelInfo *resultRelInfo) diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml index a49c17251f..666148aeb3 100644 --- a/doc/src/sgml/fdwhandler.sgml +++ b/doc/src/sgml/fdwhandler.sgml @@ -813,8 +813,9 @@ BeginForeignInsert(ModifyTableState *mtstate, Begin executing an insert operation on a foreign table. This routine is called right before the first tuple is inserted into the foreign table - in both cases when it is the partition chosen for tuple routing and the - target specified in a COPY FROM command. It should + target specified in a COPY FROM command, or when + the foreign table is the partition chosen for tuple routing of a + partitioned table. It should perform any initialization needed prior to the actual insertion. Subsequently, ExecForeignInsert or ExecForeignBatchInsert will be called for @@ -1072,12 +1073,12 @@ BeginForeignCopy(EState *estate, ResultRelInfo *rinfo); - Begin executing an copy operation on a foreign table. This routine is + Begin executing a copy operation on a foreign table. This routine is called right before the first call of ExecForeignCopy routine for the foreign table. It should perform any initialization needed prior to the actual COPY FROM operation. Subsequently, ExecForeignCopy will be called for - a bulk of tuples to be copied into the foreign table. + a batch of tuples to be copied into the foreign table. @@ -1101,12 +1102,12 @@ ExecForeignCopy(ResultRelInfo *rinfo, int nslots); - Copy a bulk of tuples into the foreign table. + Copy a batch of tuples into the foreign table. rinfo is the ResultRelInfo struct describing the target foreign table. slots contains the tuples to be inserted; it will match the row-type definition of the foreign table. - nslots is a number of tuples in the slots + nslots is the number of tuples in the slots diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c index 7b05da7871..b7c912cc3f 100644 --- a/src/backend/commands/copyfrom.c +++ b/src/backend/commands/copyfrom.c @@ -660,7 +660,7 @@ CopyFrom(CopyFromState cstate) resultRelInfo = target_resultRelInfo = makeNode(ResultRelInfo); ExecInitResultRelation(estate, resultRelInfo, 1); - Assert(target_resultRelInfo->ri_usesMultiInsert == false); + Assert(!target_resultRelInfo->ri_usesMultiInsert); /* * It's generally more efficient to prepare a bunch of tuples for diff --git a/src/backend/commands/copyto.c b/src/backend/commands/copyto.c index 03c9df5084..2ac1e27acd 100644 --- a/src/backend/commands/copyto.c +++ b/src/backend/commands/copyto.c @@ -859,8 +859,8 @@ EndCopyTo(CopyToState cstate) /* * Start COPY TO operation. - * Separated to the routine to prevent duplicate operations in the case of - * manual mode, where tuples are copied to the destination one by one, by call of + * Separate from the main routine to prevent duplicate operations in + * manual mode, where tuples are copied to the destination one by one, by calling * the CopyOneRowTo() routine. */ void -- 2.17.0 --TB36FDmn/VVEgNH/--