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 1tp1Zt-00HBMm-Qy for pgsql-general@arkaria.postgresql.org; Mon, 03 Mar 2025 08:55: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 1tp1Zs-0023ZT-As for pgsql-general@arkaria.postgresql.org; Mon, 03 Mar 2025 08:55:08 +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 1tp1Zr-0023ZH-Uo for pgsql-general@lists.postgresql.org; Mon, 03 Mar 2025 08:55:07 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tp1Zo-000fpe-1X for pgsql-general@lists.postgresql.org; Mon, 03 Mar 2025 08:55:07 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5dee07e51aaso7763476a12.3 for ; Mon, 03 Mar 2025 00:55:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1740992104; x=1741596904; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=dNJ01IzGgZjhYk2D4jURE3WtggMJQvSogT3k4dMV5U4=; b=FlBBEaycyivHltZ+51k3qABE4zWDjcj86UaoEMOJKLYqFUmPHClRRqTAtFA6g/2ujy 6lJkHDyu4JhIBXSanniov7eiYzKnwJfjcRwEhfJeBWqA7rjR5V8iaGAUE7bL1cuIgbXo E2QMp+q5D3cikWNLg9MzG8lw1ZuPR4lzE4jlhe0wFuhc+Vp+7MY8G49nUFYY0r4O35hH ako4B7vLDIQjwCjGj12blAjKFXczCdJk1ieP6PfObcjEJL9rai4YtRKVorwCfroFfEKs Jaq9HkGSFxkKdjm/ydA8hhJD94A3OwVb7MYsQrJzTGWKu416acxIyaQsePJkiqW6odma AuJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740992104; x=1741596904; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dNJ01IzGgZjhYk2D4jURE3WtggMJQvSogT3k4dMV5U4=; b=U0z+Vz0QTSfun21BSofTWt3XgiWTYNK0DuAWXdSZ54X0OblPmZTfh7UCRwLn2VN7gQ KPjiBHwyy6djQtwyzTgkRlgqm+2ynnbApWt1IXHflv14D9jXGbkNqES7U+gqfv9QaT0u VJSUks5ufR1U+Q+8hJhh3kE0JXbWAgjl5S30XfT1JbOJRL/HzRRub5JFCiyWrR+C3SH2 Jplv83vBw/yCZWsRFyyeXPxEGaT/f1tTeR/K27BnMb8Jet9zmy5m06fiVif7yWtGwuZO 116pT7dnCuETDfY1s2pAJvJ0fqZIQ59u59xEvEds27XoSJqhyT3Bt4enPYzHHWOBLw10 jeHg== X-Forwarded-Encrypted: i=1; AJvYcCVwft7f3O2FyHWa8pRE0OlFmJ4UV94ir/A8fboT9Ov04PVsCOyF3PQRwks+QAeoXanJ/gN1c+/F6LbLrO55@lists.postgresql.org X-Gm-Message-State: AOJu0Yy56VPRHgNrPirp6Nm5ZByA60dpajPSWNWFAiVL+l7OD91RisXl LVjlEVyd1gPr4ZneJrUFyFxufJtdfEtiZMNISMOgCR+miCcApD+U6nKeVnueaBc= X-Gm-Gg: ASbGncvBDlFHf7btBABwhfVWRjLtQv+WlBqVewBwh9nmQdggXJrGM9s+NHwKz75DpQ8 EBNDGki1sgwzhCm9j24HvB+IMUz6p4wErqZV91s80Qgo/WaWdDGS9jOlFTeMNWCgt5r3pAZLZ/H y9pDQTDvtNY4QDzWK/jQ/B9/vp72t3U7YNcn1Z2rfe9mcJnXOTIwadZTvbnxzT8cJLjnZU+Btm0 4Jbkv+ErJK1d1+XKw1rYhqbtNiL6XXBYcMpuksAsjA2v5JSRYPey00dky3+KmdY4nuptaHadn5d 3SUMra47L2d2ECEPlbYhQATSTxdUxmx7T4qzVBNorzUnpR0j4Pw5eNwmyum8mik= X-Google-Smtp-Source: AGHT+IElsrb4k22B8tGxsokSY1ojeO8hyyhbROwx8DMf7lBlETXRJPA7q71CG3/vNlSV6hPYGcRFkA== X-Received: by 2002:a17:907:9690:b0:ac1:e30e:bf5a with SMTP id a640c23a62f3a-ac1e30ec2c1mr74554666b.35.1740992104575; Mon, 03 Mar 2025 00:55:04 -0800 (PST) Received: from localhost.localdomain ([2001:871:5e:d3c5:e17e:b83b:d2c:3bb3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-abf76063ab8sm187710866b.73.2025.03.03.00.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Mar 2025 00:55:04 -0800 (PST) Message-ID: Subject: Re: Please implement a catch-all error handler per row, for COPY From: Laurenz Albe To: me nefcanto , Greg Sabino Mullane Cc: "David G. Johnston" , Tom Lane , pgsql-general@lists.postgresql.org Date: Mon, 03 Mar 2025 09:55:03 +0100 In-Reply-To: References: <2961422.1740846012@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2025-03-03 at 07:14 +0330, me nefcanto wrote: > The point is, that there is already an `on_error ignore` clause there. Th= is means that > somewhere there is a try/catch per row. If I'm wrong, please let me know. The crucial point that Tom referred to is the "per row". What is a row? Imagine you have a COPY FROM statement for a table with three columns, and the data look like this: 1,Smith,John 2,Lewis,Jerry Lee 3,Prince 4,Albe,Laurenz We may be able to guess what is meant, but how shall the machine know where the line boundaries are, which data to ignore and which to process? Currently, that is no problem, because errors are only identified after the data have been successfully parsed. Yours, Laurenz Albe