Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snfSx-005E2e-Gq for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Sep 2024 14:34:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1snfSw-00D6b9-VB for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Sep 2024 14:34:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snfSw-00D6b1-Hc for pgsql-hackers@lists.postgresql.org; Mon, 09 Sep 2024 14:34:06 +0000 Received: from udcm-wwu3.uni-muenster.de ([128.176.118.30]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snfSt-000JZO-22 for pgsql-hackers@lists.postgresql.org; Mon, 09 Sep 2024 14:34:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uni-muenster.de; i=@uni-muenster.de; q=dns/txt; s=uniout; t=1725892445; x=1757428445; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=2rcbBuHw8JEqa3mChr7X0nY198AwUSzFlLC/Ivg/SHA=; b=AJ+lxAjFIov+wSRXNg4VF4SM2tBpk0hqJo0znjZaGbwHTSFxnJlQPAEH 4O+rQW9oY0r6K7XRrRf3+OkFyb3QKdtYfSXzIVe51ZvUCwWIgskpSlHNI wBkTFGBychec2EoEowobh0cLp98Q9V+2ua21fYv1QBqipwDr5hpLw5uVK G6qHJ4eFJtVMMiMQKP4ZRr1KXXcS6HUWiOvDS/CKshmvaffH8WXx+mrrE iScKT6Pk+XTc7/il91/gRgZAX2NJMbNmfVkUfnMxXJRWyhAyLwTPncIXr Yx8cRFZvm86Ry5rVIqD0xDYkHyxR4MlT0jPl5FLoBWQt4fNsIILq0HaGf Q==; X-CSE-ConnectionGUID: vjanWknNR465n2St4izVnw== X-CSE-MsgGUID: aCSlp7HtT0+uNoCt6pc+uQ== X-IronPort-AV: E=Sophos;i="6.10,214,1719871200"; d="scan'208";a="8671163" Received: from secmail.uni-muenster.de ([128.176.118.4]) by udcm-relay3.uni-muenster.de with ESMTP; 09 Sep 2024 16:34:04 +0200 Received: from [192.168.178.27] (dynamic-080-171-204-165.80.171.pool.telefonica.de [80.171.204.165]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTPSA id BF46D20ADF05; Mon, 9 Sep 2024 16:34:01 +0200 (CEST) Message-ID: <3d6b5885-16a1-475d-b56f-41701c48d9d4@uni-muenster.de> Date: Mon, 9 Sep 2024 16:33:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row To: jian he Cc: "David G. Johnston" , Yugo NAGATA , torikoshia , PostgreSQL Hackers References: <20240129172858.ccb6c77c3be95a295e2b2b44@sraoss.co.jp> <04bf425ad1b15a4daefe96c478a5253b@oss.nttdata.com> <20240206191937.72eaf0ccc20cfea37944b422@sraoss.co.jp> <76da9fcc-93c5-4053-872e-12932a95356d@uni-muenster.de> <6eac5b45-7f45-4c7a-aae1-e90db8be2e08@uni-muenster.de> Content-Language: en-US From: Jim Jones In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi there On 26.08.24 02:00, jian he wrote: > hi all. > patch updated. > simplified the code a lot. > > idea is same: > COPY t_on_error_null FROM STDIN WITH (on_error set_to_null); > > If the STDIN number of columns is the same as the target table, then > InputFunctionCallSafe > call failure will make that column values be null. > > > If the STDIN number of columns is not the same as the target table, then error > ERROR: missing data for column \"%s\" > ERROR: extra data after last expected column > which is status quo. I wanted to give it another try, but the patch does not apply ... $ git apply ~/patches/copy_on_error/v3-0001-on_error-set_to_null.patch -v Checking patch doc/src/sgml/ref/copy.sgml... Checking patch src/backend/commands/copy.c... Checking patch src/backend/commands/copyfrom.c... Checking patch src/backend/commands/copyfromparse.c... Checking patch src/include/commands/copy.h... Checking patch src/test/regress/expected/copy2.out... error: while searching for: NOTICE:  skipping row due to data type incompatibility at line 8 for column k: "a" CONTEXT:  COPY check_ign_err NOTICE:  6 rows were skipped due to data type incompatibility -- tests for on_error option with log_verbosity and null constraint via domain CREATE DOMAIN dcheck_ign_err2 varchar(15) NOT NULL; CREATE TABLE check_ign_err2 (n int, m int[], k int, l dcheck_ign_err2); error: patch failed: src/test/regress/expected/copy2.out:753 error: src/test/regress/expected/copy2.out: patch does not apply Checking patch src/test/regress/sql/copy2.sql... -- Jim