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 1t6U5g-00DII6-DN for pgsql-general@arkaria.postgresql.org; Thu, 31 Oct 2024 12:15:52 +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 1t6U5e-000kFf-8X for pgsql-general@arkaria.postgresql.org; Thu, 31 Oct 2024 12:15:50 +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 1t6U5d-000kFU-TZ for pgsql-general@lists.postgresql.org; Thu, 31 Oct 2024 12:15:50 +0000 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t6U5b-003zre-UV for pgsql-general@lists.postgresql.org; Thu, 31 Oct 2024 12:15:49 +0000 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3e602a73ba1so464824b6e.2 for ; Thu, 31 Oct 2024 05:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730376945; x=1730981745; darn=lists.postgresql.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eC25csG+Jr30BSaUSoN05J+nWx7GPT3sivSKR7gp4H0=; b=cAMb9D1geKx3wjBsXINMU1nZQMVy2UguAZA8gu068PY00XONrI2HHkaVQKFRsSoDxj M6J8dSCkJoHleNsbZ+Gr/OtiD+wHc1kzxWsWEMLukeejxUC6J5lbKyBLxA25piFKYvJS IUPIC6tmrKyqFANRfscY5wmIRYaLppjDQDiOqJBWyF4gQD/8/rUeeYU4FIfOlLlxsUnR pKDwPiqvBQO6xLd7MhCBMZimeOsD7EooiB3emQaHA+Cpvd21LILKHlamDWhBjtTWhxq/ KUoZcQu+AiAoLMuKXtE5YjTDX3rHs/N63lv0o6CoUkA4uwqAuMCQbgVIMT0yzx6cmujF a0pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730376945; x=1730981745; h=content-transfer-encoding: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=eC25csG+Jr30BSaUSoN05J+nWx7GPT3sivSKR7gp4H0=; b=BDLoYzWoyofv+VjQ3C58A8mGexzgx0OoBAT0nKZyHS/aOr30bqQu5QlwPOs5XbHN4q z+VUsJI/gymDhFMJ+Sykq9/vEYCy01vr5Zzb24YKPbO8bgIqO9HGf6ymcAdAVfCX+lxI CCJQ5+Et4Jsjhssag4InbpP3YDSgO6dji08j3IQw3txvbt4xlUw7m2Jriwx7d1TYv3h7 peRLdmOPjRM+8pn7YrUAJdhCHFGE+NQ2ute7Ap1LFcW9q3Tt5n0BZJOA/i8pXX4v/vtS jri/63pK+Y1jSGutnwejBfRf4EzF+ecAkGuEoil0qM/tlKYRFEPYyZdRn/lXOowfgpkt 78rw== X-Forwarded-Encrypted: i=1; AJvYcCWyF3GN/eS8aHSoIld5OWntQYXsuH6LICY6c1yxXsQhu5YDkzU81ABFx85jLH1f6Xy2kW5xxfsKLpTrMu07@lists.postgresql.org X-Gm-Message-State: AOJu0YyjyHY7gvQNCnm5NhAKvCcFhDMkh8mgNqsjUD3ec9ECteN/+08y BrpepSDF9VbjuCRIKOjVeVUxA45FAuhMq/FLTwevg7rK4IDHlzCjlXrL2tkXuwi+iRCoyEybHF+ RbWJr/008hCyIHr08E6mCvibEb5hNug== X-Google-Smtp-Source: AGHT+IG9KUBtXUZhT7P1lYC9tBQNc0+ouRUF5CJaYVy1XzR0HZFbVuh3dEg2QMq1jw/AIWml3W9Y/H9iKA3/UraMl6M= X-Received: by 2002:a05:6808:398c:b0:3e6:60dc:5aee with SMTP id 5614622812f47-3e660dc5bacmr2476829b6e.3.1730376945515; Thu, 31 Oct 2024 05:15:45 -0700 (PDT) MIME-Version: 1.0 References: <20241031113832.GA3409@wolff.to> In-Reply-To: <20241031113832.GA3409@wolff.to> From: Dominique Devienne Date: Thu, 31 Oct 2024 13:15:34 +0100 Message-ID: Subject: Re: COPY documentation with regard to references constraints To: Bruno Wolff III , pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Oct 31, 2024 at 1:04=E2=80=AFPM Bruno Wolff III wr= ote: > I was unable to find any documentation clarifying if using COPY to load a > table with rows referencing others rows in the same table, whether I > had to worry about ordering of the input. > What I found (in 17) is that even if the references constraint wasn't > set as deferrable, I could have rows for children before their parents > in the COPY data and things still worked. AFAIK, DEFERRABLE is for temporary violations crossing statement boundaries= , to postpone the enforcement of FKs at COMMIT time of the transaction. While a single COPY is just one statement, so whether a temporary violation for self-referential FKs would occur would be implementation-dependent, and thus "neither logical" nor predictable. Applies to other statement types too. But of course, more authoritative answers will come I'm sure. --DD