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 1thALc-00HDtm-80 for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Feb 2025 16:39:56 +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 1thALY-00F97N-IN for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Feb 2025 16:39:52 +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 1thALY-00F97F-9D for pgsql-bugs@lists.postgresql.org; Sun, 09 Feb 2025 16:39:52 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1thALW-004BMb-0Q for pgsql-bugs@lists.postgresql.org; Sun, 09 Feb 2025 16:39:51 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-ab795ebaa02so324999666b.1 for ; Sun, 09 Feb 2025 08:39:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1739119188; x=1739723988; 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=8MtJk0dsX0NBiZS0Fpw3aGV+P08BfrtfxmjfDK1I3kY=; b=J4WRsDLf2jjMNCRNBBCSsVhP1f3iHzPLScPFna2H/jW8GyorN9XuN0zkg9kHgvA2um rqY7VvjjD+9tj9mF9OusNobhlcZtGbzGAEiq83kaf9nUocVVyokaBfMMI/vH20nl4kgK tZtwNAber9+naeadcd9f4J+zhonnYQkAlEhz5aq364Q/S5kJntxqhnFzofDgUKxEcdjZ HhsH4lQcKYpquhC/T0u5NMjkF7c8wwN2iq+56D/TrUgzguXmt9xIdXcDjWyIwaeaQmTZ hoHjEOsJEsOWBUPiLFGmXHobwEmwpFOEj47cPPqrKlz3g7Un3sw2dSfzjyL/7FI0AbVE 5Fhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739119188; x=1739723988; 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=8MtJk0dsX0NBiZS0Fpw3aGV+P08BfrtfxmjfDK1I3kY=; b=iDqxV3ogX9GzBZXoRB10QV78Et1lvtQgq7vilL0j3evby/KU+WgnZWDHfm551WGCaH AfX7CNb+PzyXFo7gupT6/7UC6xLXyL60SrdBXhytDnG9sOq2r4MYvqasVPkHKEyghMGI r+9UVesMWG7W51R3te2RYvbEJ8uWEjpc9ld26yPPxiXS4P7OfYGGL7joXQGbLa8U4u6e C1hplckyMSj4OQmJu9Qign4ujWCX7zmlxYYDSUN5BztyQblQKUc/hEgr/Q5EP8e7nBjU GIoJenk4f0iLk37kZ/LyBpAQ7wKpiJC0nS2V1/SojgaRTNprquzzudVbvgQu+/FcKmzh VoTA== X-Forwarded-Encrypted: i=1; AJvYcCWoLaxVcqjReRfwPVNm9dSFNTvZ47doZrx6eKUiMcMY9idVBklPe85HNG7F3yCgA6SVR9UWplESdHJP@lists.postgresql.org X-Gm-Message-State: AOJu0Yzn+GWSTLKDqsrX4+thFYsCS6Kw+S6cLx77w8BpFn5P+WrztcnB fTJXNkTWcZHXNyzvuWAuAoPdaONdRz5nlJNou7c84ozmVmqdAUetnXZFCrzrgiU= X-Gm-Gg: ASbGncsdiPzmZTgX8hKwnULwgb1UhGSkaLfFzBQDofGKotQ4dCtusdWpBMjv4rkI6aB b/nX0d4mV3AY26FPFZnXjR9V/NW3l7DQeihGC8WpLqarNItGyuuCSK/GyD/d5xB1pXlRR7LQ6tz Y0PAjc0h9KAXf26hh/9CKTpPUBbtUmm0vHbmJgNKZFcuLnNP+Vj4deK+mCvWvoArnmAAo0wMaLS zrcagWS408NBsbfTYS6mCwGJQkNjNHPg+z/LWd67Vr8tgImBfTa3N5fnoZhCqR8x+7RtfyuExef x9krcnGn+QW/4hvZKZVXBQPAas5g9qilq+Eu X-Google-Smtp-Source: AGHT+IGSKAQRW8y5UyjNKOmLcRnkE6zhUuHjotyu4nzOonmbO+Uu+37WzfGsf6i9bEGKCDIt9XkHfg== X-Received: by 2002:a17:906:cc15:b0:ab7:93dc:ffad with SMTP id a640c23a62f3a-ab793dd0d38mr772857266b.3.1739119188243; Sun, 09 Feb 2025 08:39:48 -0800 (PST) Received: from localhost.localdomain ([2001:871:260:9c88:cdb3:e735:5fe5:f7aa]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab7b6338c1bsm146914666b.48.2025.02.09.08.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Feb 2025 08:39:47 -0800 (PST) Message-ID: Subject: Re: Bug in copy From: Laurenz Albe To: me nefcanto Cc: Zhang Mingli , pgsql-bugs@lists.postgresql.org Date: Sun, 09 Feb 2025 17:39:47 +0100 In-Reply-To: References: <3a1189c579c1e0189f3aae60d2cdf7b7dcd6c1cd.camel@cybertec.at> 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 Sun, 2025-02-09 at 16:00 +0330, me nefcanto wrote: > @laurenz if I use `insert into` or the `merge` would I be able to bypass = records > with errors? Or would I fail there too? I mean there are lots of ways a r= ecord > can be limited. Unique indexes, check constraints, foreign key constraint= s, etc. > What happens in those cases? With INSERT ... ON CONFLICT, you can only handle primar and unique key viol= ations. MERGE allows some more freedom, but it also only checks for rows that match= existing rows. You won't find a command that ignores or handles arbitrary kinds of errors. You have to figure out what kinds of errors you expect and handle them expl= icitly by running queries against the data. I don't think that a catch-it-all handler that handles all errors would be = very useful. Normally, there are certain errors you want to tolerate, while oth= ers should be considered unrecoverable and lead to errors. Yours, Laurenz Albe