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 1th0OV-00FdNc-1N for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Feb 2025 06:02:15 +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 1th0OS-00BVi0-Hi for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Feb 2025 06:02:12 +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 1th0OS-00BVhr-8a for pgsql-bugs@lists.postgresql.org; Sun, 09 Feb 2025 06:02:12 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1th0OP-004f6w-1j for pgsql-bugs@lists.postgresql.org; Sun, 09 Feb 2025 06:02:11 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ab2b29dfc65so535688166b.1 for ; Sat, 08 Feb 2025 22:02:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1739080929; x=1739685729; 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=AlsHI1sOdlTOb30S1G1lw1JVGkps/zGx0fjOlrDWz/w=; b=mABE5cLC6UW7n10krGOTaY4qaOCoWtj5DxMYKdTk/hcAEfsDWB6JPd4uGQq89C3Ebe BsBi/2wix5W90uFqXDO121WXSiqsSMJNMkPGTFzDdOaOp3htyb8BwmHrsd9rtGNKxUtf 6TxdPBG2a1zjc45qeAO6EfUkbtPsBgtBCQNViXOF7J8oBZAEMlmIcF7c4pvVdVmVNrKo Lk9vGmfJC76BAgYyTVWV1XzgZ5u4VJ1ifoOznjcvdH9VvzpwIvW+CfU4ArEGr9xHhy8h SGefnmm/NsRp1nmFmiRSanZwUXxVTPfS3x4T7u94UqT69INLVo7MDV+KBGfP4tGxLTXg rcJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739080929; x=1739685729; 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=AlsHI1sOdlTOb30S1G1lw1JVGkps/zGx0fjOlrDWz/w=; b=hakS5ciFq8419yaiPtIbXXH3fRs6CGo3r6FipTAeyt7/2diPvaxWULj81aq1UuxZ+f OfhTuflLel/aYmiX7LZ43yzxQ+SeSJ6ZBTMSuXpUHfTpGZW0vjyRI1Pbi3scAg/9aM50 EDDFV0zK8FLzw4DsG6q/i3ozYV5Bz69fWV6Bma8Ze+jQ6Dz5OvaoYfo3F5MxKduMrZDt DvnaQZ15p4/vYC0/YhvJdZMI9580xdQV3uqSaVtgam5XpR5fsyA8NajKOd1jSpi5vqzs Y1H2SQfMtV/H/Eu2fEy/9+JFKNfd8II/hHyFovOzQQwHFwI5x+ZPNQfJkeEccd2fKuL8 t/Jw== X-Gm-Message-State: AOJu0YxFf0q/4urL/e4aynVsZxx4vX0HV7bWbVvAQvIkD7ZTXINdJGle LnqU+rVeWGxiCjrh0aICh6nX/JRqpM8VZic6Zt5/zOxPALN4bQaeOhGJNA+NcTM= X-Gm-Gg: ASbGncuy0p5Xypuz30BjDSt10fzdVp6R0KGTgM+oAlLvNe5p/7wshQPHDE/DKkgQKJj zkdtn8cEkBmrT0Td6Ws4pZc1hLGSFCM9Qpmvh2FduxQsnCpTaeX5dgJAimgAWelObfnqWVWtS4s M2k3miO2c6Yz+d+we5mpVuOf4QcTSAipI1hIaDPBNoqhpEbuua9XCD88g18A65/buK5MZtBHDxy M6h2rwTF2ZdI+IP/neKe++dEoSca+UOw4qYqsEcIZbcWvczFC1Wa5MOX2osZUjciMu5ygFtJ9yF rYGNYfjU64gq6JHDA4P+3ucFNsttHPTw8ctt X-Google-Smtp-Source: AGHT+IFRy3XiFBp6tgnxsbpQdF3IA233uPkO9K/390hoOcEsDPvPXk8JDQWFLh6UqkGmYG2Kp96sjw== X-Received: by 2002:a17:907:3f27:b0:ab6:58bc:715b with SMTP id a640c23a62f3a-ab789ca29b4mr883360366b.55.1739080928204; Sat, 08 Feb 2025 22:02:08 -0800 (PST) Received: from localhost.localdomain ([2001:871:260:9c88:cdb3:e735:5fe5:f7aa]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab7860da0e7sm497456366b.110.2025.02.08.22.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Feb 2025 22:02:07 -0800 (PST) Message-ID: <3a1189c579c1e0189f3aae60d2cdf7b7dcd6c1cd.camel@cybertec.at> Subject: Re: Bug in copy From: Laurenz Albe To: me nefcanto , Zhang Mingli Cc: pgsql-bugs@lists.postgresql.org Date: Sun, 09 Feb 2025 07:02:07 +0100 In-Reply-To: References: 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 Sat, 2025-02-08 at 09:31 +0330, me nefcanto wrote: > Inserting a million records not in an all-or-fail is a requirement. What = options do we have for that? Use COPY to load the data into a new (temporary?) table. Then use INSERT INTO ... SELECT ... ON CONFLICT ... or MERGE to merge the data from that table to the actual destination. COPY is not a full-fledged ETL tool. Yours, Laurenz Albe