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 1tvVz9-005NLL-Iy for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Mar 2025 06:36:03 +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 1tvVy9-00HZdr-DG for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Mar 2025 06:35:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tvVy9-00HZcp-3g for pgsql-hackers@lists.postgresql.org; Fri, 21 Mar 2025 06:35:01 +0000 Received: from mail-yw1-x112a.google.com ([2607:f8b0:4864:20::112a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tvVy7-000GhT-0s for pgsql-hackers@lists.postgresql.org; Fri, 21 Mar 2025 06:35:00 +0000 Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-6feb229b716so15621807b3.3 for ; Thu, 20 Mar 2025 23:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538898; x=1743143698; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=AmY1MrPzWMyFMmQp6HFrixx+ez7+VzzQkXYV8vcwA/I=; b=lhhoJWvVK9iDWdeSyGrzV9bNqlpqblApwcox/MW/fA2L5GMeWAbq4azlW/N/315es7 KeFaR4r7/wFQTCkNkNhH0L5JnFISKauJ3nNhh41pXXE110gMJw08BFGDvJsSHzOGpKaV AQbRkgdz1X6oZbpbULGrDzFTga8RMpM933vkxkAjxAmTUA7DG7xYOvdJcQfw4lYVyjIJ XJ6iCgCL7/+372cF+jINyLh6pfDy+CqP894TV82LUUsbPyVJ/cJyyYkIyUH2rG294hVp ZC1xFV2J5/wdY0E1PgPxFsjgc1jY4eqC5swRxfEyA9/TweiIFwyGv3vE335f5b8CFIkn 5JMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538898; x=1743143698; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AmY1MrPzWMyFMmQp6HFrixx+ez7+VzzQkXYV8vcwA/I=; b=O7HZCEJdc2eX2/hbh18Lzy77svlqeydFRmAkhCYS3CmMJ3evWBbTDzM0OPKjF3w8iu sri7ZUPorYNrWhEClrZMecNkZbusWcIozdADbPgGjJyJIyIZzGF+WG4yPKkUERJ9exUD /ySxhCC+TtRnaUi6tPW71+1qtvYiOE6xzHX1l16sPdlIdcBnYFNsZBNcEJbP2cRuTqLJ wjfchb/mUac9Aie7bOJlqB8Q1pHpoROZ/vz0ZROqpvxTHmB0q/zRLqY1pvP5K3Z6M1Lz DliRfTJQU03oOyUSRMRLdFVs1wy3dVBb38cttN4NsUzUM44YI2KS3yoRKtUcQudycCb/ fUVg== X-Forwarded-Encrypted: i=1; AJvYcCVRh5jk26mmMFh+y8BNiApeAd25Pk6fgrZjDBLejuNIMK5CDyu2BqD9bA4GW/UB+/mFv+OrnJf+/QXpVhIT@lists.postgresql.org X-Gm-Message-State: AOJu0YxIFzh790dj7cx4FaFtKlSBJMqOqA6N2wClXIUXXhKCnRp6JsLh /USzyFyGWqsv6hdKDCjYa6Iv5iQ3jrgZ3VOr2EzKrcEDSCnhKeIDpyxlpmHP1t1BzN9g4p/DJne nSXxUcVQWskB1MwRZzRjOoXiaxEU= X-Gm-Gg: ASbGncumompjAHlqJOVApCuYL6q4nJ6vrE2mPfIBcNomQYkge0/vZTTJL5ceDEUeBoF V8eapROOTmFC0zIRVUeXfM3OP/JAY0mk+Q+SKOckgy6qRPHWLLI7wu0UCAwC3Eohsrf5Fcsv/Rj +oviFmuTBrox9ecJlhQqRrU6lMkOhSWs3E/qI= X-Google-Smtp-Source: AGHT+IFIILdTPax+JkL3ojjFRjq+WzaAjv6yNAR4M4dlKHLSfnB9VQQVHbDoTOVWvNRY4krLzk+3k0YO52T0Faoccic= X-Received: by 2002:a05:690c:4905:b0:6fe:bf9d:8cca with SMTP id 00721157ae682-700ba9ba5f4mr27889717b3.0.1742538898384; Thu, 20 Mar 2025 23:34:58 -0700 (PDT) MIME-Version: 1.0 References: <90dc6e9d-9348-485a-b27c-7b1637f06c2e@uni-muenster.de> In-Reply-To: From: vignesh C Date: Fri, 21 Mar 2025 12:04:46 +0530 X-Gm-Features: AQ5f1JootJhXxWOGlC6FxTlM-d2reQ8ap0ADuGtg5neDbptO229gwjWgn_EJAts Message-ID: Subject: Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row To: jian he Cc: Jim Jones , Kirill Reshke , Fujii Masao , "David G. Johnston" , Yugo NAGATA , torikoshia , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 18 Mar 2025 at 09:26, jian he wrote: > > changed based on this. > > also minor documentation tweaks. Few comments: 1) I felt this is wrong: diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index 9a4d993e2bc..7980513a9bd 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -3280,7 +3280,7 @@ match_previous_words(int pattern_id, COMPLETE_WITH("FORMAT", "FREEZE", "DELIMITER", "NULL", "HEADER", "QUOTE", "ESCAPE", "FORCE_QUOTE", "FORCE_NOT_NULL", "FORCE_NULL", "ENCODING", "DEFAULT", - "ON_ERROR", "LOG_VERBOSITY"); + "ON_ERROR", "SET_TO_NULL", "LOG_VERBOSITY"); as the following fails: postgres=# copy t_on_error_null from stdin WITH ( set_to_null ); ERROR: option "set_to_null" not recognized LINE 1: copy t_on_error_null from stdin WITH ( set_to_null ); 2) Can you limit this to 80 chars if possible to improve the readability: + stop means fail the command, + ignore means discard the input row and continue with the next one, and + set_to_null means replace columns containing invalid input values with + NULL and move to the next field. 3) similarly here too: + For ignore option, + a NOTICE message containing the ignored row count is + emitted at the end of the COPY FROM if at least one row was discarded. + For set_to_null option, + a NOTICE message indicating the number of rows where invalid input values were replaced with + null is emitted at the end of the COPY FROM if at least one row was replaced. 4) Could you mention a brief one line in the commit message as to why "on_error null" cannot be used: Extent "on_error action", introduce new option: on_error set_to_null. Current grammar makes us unable to use "on_error null", so we choose "on_error set_to_null". Regards, Vignesh