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 1kKJrs-0000r1-Rl for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Sep 2020 11:20:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kKJrr-0001X4-3T for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Sep 2020 11:20:23 +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 1kKJrq-0001Wx-QR for pgsql-hackers@lists.postgresql.org; Mon, 21 Sep 2020 11:20:22 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kKJro-0007W9-1t for pgsql-hackers@postgresql.org; Mon, 21 Sep 2020 11:20:21 +0000 Received: from [192.168.27.152] (unknown [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 481D521C1FD6; Mon, 21 Sep 2020 14:20:17 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1600687217; bh=LG4IfLg1v/VO4XK6n4JibIU0cA793F/Xiy8Wy2/PyTk=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=MBGvoXpxwhc0YVK5Q/msHiUKc3+jdFTldaDrL07cJl9F8KSRSO6hI6/UxStE3+CjF 7/fg5uq1fG1I4kPqcTzUvKdG0m0Z6h0sY10hU16sXmHTCKYfqG+UazC1xVOdhZImkV 3vfPxTtLMXIWI9xndy7J3wRBanIKfsZqHOWWZWY0= Subject: Re: [POC] Fast COPY FROM command for the table with foreign partitions To: Amit Langote Cc: Alexey Kondratov , Michael Paquier , Ashutosh Bapat , Ashutosh Bapat , Etsuro Fujita , PostgreSQL-Dev References: <20200907072651.GF4867@paquier.xyz> <19ba27e7-ee1e-9117-68ad-fd609b5763ca@postgrespro.ru> <0c67618c2e43b1dccb260dd6f90eeac2@postgrespro.ru> <27e119ab-70a4-a08a-deb2-d882e2ce9435@postgrespro.ru> <21741c8e5df397d88e9eff3e741baf91@postgrespro.ru> From: Andrey Lepikhov Organization: Postgres Professional Message-ID: <2a33a068-749c-4c18-ba74-bd6fbf37abce@postgrespro.ru> Date: Mon, 21 Sep 2020 14:20:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This patch currently looks very ready for use. And I'm taking a close look at the error reporting. Here we have difference in behavior of local and foreign table: regression test in postgres_fdw.sql: copy rem2 from stdin; -1 xyzzy \. reports error (1): ================= ERROR: new row for relation "loc2" violates check constraint... DETAIL: Failing row contains (-1, xyzzy). CONTEXT: COPY loc2, line 1: "-1 xyzzy" remote SQL command: COPY public.loc2(f1, f2) FROM STDIN COPY rem2, line 2 But local COPY into loc2 reports another error (2): =================================================== copy loc2 from stdin; ERROR: new row for relation "loc2" violates check constraint... DETAIL: Failing row contains (-1, xyzzy). CONTEXT: COPY loc2, line 1: "-1 xyzzy" Report (2) is shorter and more specific. Report (1) contains meaningless information. Maybe we need to improve error report? For example like this: ERROR: Failed COPY into foreign table "rem2": new row for relation "loc2" violates check constraint... DETAIL: Failing row contains (-1, xyzzy). remote SQL command: COPY public.loc2(f1, f2) FROM STDIN COPY rem2, line 1 The problem here is that we run into an error after the COPY FROM command completes. And we need to translate lineno from foreign server to lineno of overall COPY command. -- regards, Andrey Lepikhov Postgres Professional