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.96) (envelope-from ) id 1wD26C-002XS9-0h for pgsql-docs@arkaria.postgresql.org; Wed, 15 Apr 2026 15:24:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wD26B-000Rzv-1E for pgsql-docs@arkaria.postgresql.org; Wed, 15 Apr 2026 15:24:15 +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.96) (envelope-from ) id 1wD26B-000Rzf-0O for pgsql-docs@lists.postgresql.org; Wed, 15 Apr 2026 15:24:15 +0000 Received: from mail-yx1-xb131.google.com ([2607:f8b0:4864:20::b131]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wD268-00000001F7u-3dye for pgsql-docs@lists.postgresql.org; Wed, 15 Apr 2026 15:24:14 +0000 Received: by mail-yx1-xb131.google.com with SMTP id 956f58d0204a3-650775f427eso7199772d50.2 for ; Wed, 15 Apr 2026 08:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776266651; cv=none; d=google.com; s=arc-20240605; b=J+kzY9qKbULl+ZktYcfm3AJ/kNLbp1ByOj2T3RUej9ntOgDKUV27uOpO5oMj3c/XUC DbNm0ldeGUP/+159klXj4/v5+SlQGTR/JV6PZ2O8ibLI9mG7J9tOzhO2qInUUMqUUuq7 rD5ikTg/Obju52u8ttNnQ8YDR+rtjmxpyDeW0sfrxF9S2x46KhgxakOnw4YYMbNCef0Z q2fmU3vgu312qEkmV3pQo97AGQLWSxaV5Og8XhOVEj0OpcUY6G9Bg7mnesWUuMfnPTyI S8hL3SpmT/y/XDLJtZ3vWz1C0EiFrT8qoTKAncPo6DI3ssUT33pYUX5JfGvCpsxGP62f VOww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=F5nWIeC5K5rd3Rp3TJhBOSiS+TJgaaudIbYd9MEz18w=; fh=IudUSii+ss6nA0Tu/zF6ddEloCoIGUahH5QCFwnwe78=; b=QrToYJXzuUzsQpYe7ujYGh4OeZgxMPGMw0dxiBrydeTi21hrE5iZQj2NvE0g91X5Y4 ulOVrzNXA9Le0jhkxmxIZ0KhQ5vuelB+yJNKTBjMurArH9VBa723jesxrAAfc+RSltcH NatB0vVEcPzSWkuQyRGCdFvn2gsCmVvA2amtCF3ZYp49gvIZWNz874WdBiDnHRhKlhTW zZBtSv9Tl3TZcCeOdnpY6uIV9I05PungERQ67Z1CnRbKwEUujjTPaOBq3EWuoHT7isxG x78R9p9gI9s+Bg7OYtjCZ4TND9C+tWbtGBxhrg8PlZZw9Otbu9JaFPO7jIbo42Snvv/R Lihg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776266651; x=1776871451; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=F5nWIeC5K5rd3Rp3TJhBOSiS+TJgaaudIbYd9MEz18w=; b=CxI+wYwjgstg+Yqk4Z7/hQqaeSKi2nSUF+WD+nPO7UbWnxxUarkCYxutTqqBxFIdoz WD8qZDppdD8Y8T/6Wfo/huiGyq9OYyXnkellvV/3toTGLjZT61t4i6d9C18Jl2+OGkJd zCCOETp9PicJE5ybKRwBC56KIgkHFiyI7h8BAm9BHuhGCFGvZyCZEj4fjmmQU6glzcnD KHpNULOSH9b+XDETGH6CDmwjONXYVU6AR1OORsMeO5M6mcF2uaHh/1l96kRX35vJg6X9 LfH3f1F8FBRf/IzW8QiG9yI155yqZqbWBN/+yewIIU69enwCdRwKI8vTlwzw3OPIU7hu YXlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776266651; x=1776871451; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F5nWIeC5K5rd3Rp3TJhBOSiS+TJgaaudIbYd9MEz18w=; b=NjAxu0o+ryCcGwBsqTM+otHyuzoczTYHNg2FoQO9NsiH/rRjlC77oGV/IU3kUYUyRo nzDq/U9867pXHX+FChTcD3PHmqLx3yeig9CcSFbcEGhqr9Y7J2OSVDjYFQ2dpY5EL2EW aWp8krbk1dwqvtQM4sHOmu9s2EW73In/16fGAJisZ2CRdEhjIsb2+3tinMMmj5GXZyOX ULlJsiOX5hFCg2XPKJdaS+BlgVDDmTfLpavfEg3eisDDi0a46/K5ts3TwlDS6Za2zrE4 8h2NzZBpxNDstNdfNDmVJDp0CXjPk43c0Ie82PNRnnYd4AYZAwSvVLfDyVS9eqgTroc5 hjDA== X-Forwarded-Encrypted: i=1; AFNElJ/hVfbc74cwnwgBEsrzwp7BC88FWphziPi/flsRcOKlQ7hcja5XTKV2mUVyjnfznnjgireVzj6C08QF@lists.postgresql.org X-Gm-Message-State: AOJu0Yzc75lqUwGCKmHOXkUmXA5iZYxIkARjs+1IOxjEGD4PtSm5yTjr 6rriQpDs+9BykcycvYKWBxGq7J0H28hLMxZgTt8P67OTh07MMezAg2XXWDYiV94OEHaoORubApN +hVIEJ0wXJTPiFOhNYXky3Rjnn8YvsB0= X-Gm-Gg: AeBDietQPHnTj07hGWHa/CX6/wWsR5QE424Nad4tifzKP2SsnTbHBuM6xTaTeFBQzGh xx6T/kQmAmipXbFCpzD2zJBm0v0OIpGmw4jGbRTuu0PCPDr3/eUxMrx5nVaDMAwsYSoLb9XQEvv pTSKmOJUeWeaZUHvFMAv0dSIssH+XqUO0PG4kWjakZToBIdEs7+sW/YobcKNTWsbBbPuM53PXZn DKOg8UUGdL7sfV0Iz+7y07mIPzoaJ675EFXV2Qw3Uqg/YJjkw3SfhfA5EdBuV+uaP6aYn9LoaHL pVmgpHurtl0hbd8Vjg== X-Received: by 2002:a05:690e:4362:b0:64e:f86e:9de5 with SMTP id 956f58d0204a3-65198ab2b8emr15067422d50.23.1776266650891; Wed, 15 Apr 2026 08:24:10 -0700 (PDT) MIME-Version: 1.0 References: <177616491576.403057.11334419722719232554@wrigleys.postgresql.org> In-Reply-To: <177616491576.403057.11334419722719232554@wrigleys.postgresql.org> From: "David G. Johnston" Date: Wed, 15 Apr 2026 08:23:34 -0700 X-Gm-Features: AQROBzCmL5LNDNUDiS6YxLF2Qw5f0wWOmgYG62sGKr36BkRRz0VL1te6fUpHgok Message-ID: Subject: Re: Example. Foreign Keys Constraints. Wrong Columns To: postgresql.org.reach457@passmail.net, pgsql-docs@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000c0bd8b064f814e7e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c0bd8b064f814e7e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 15, 2026 at 7:51=E2=80=AFAM PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/18/ddl-constraints.html > Description: > > > https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAI= NTS-FK > > Given that users has: > PRIMARY KEY (tenant_id, user_id) > > This: > FOREIGN KEY (tenant_id, author_id) REFERENCES users ON DELETE SET NUL= L > (author_id) > > And this: > FOREIGN KEY (tenant_id, author_id) REFERENCES users (tenant_id, > user_id) > ON DELETE SET NULL (author_id) > Produce an identical outcome. The absence of a column list on the former causes the system to look at the primary key for the named table and use its column list - which is (tenant_id, user_id), same as the later explicit version. David J. --000000000000c0bd8b064f814e7e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Apr 15, 2026 at 7:51=E2=80=AFAM PG Doc comments fo= rm <noreply@postgresql.org= > wrote:
The following documen= tation comment has been logged on the website:

Page: https://www.postgresql.org/docs/18/ddl-= constraints.html
Description:

https://www.postgresq= l.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK

=C2=A0
Given that users has:
=C2=A0 =C2=A0 PRIMARY KEY (tenant_id, user_id)

This:


=C2=A0 =C2=A0 FOREIGN KEY (tenant_id, author_id) REFERENCES users ON DELETE= SET NULL
(author_id)

=C2=A0
And this:<= /div>
=C2=A0
=C2=A0 =C2=A0 FOREIGN KEY (tenant_id, author_id) REFERENCES users (tenant_i= d, user_id)
ON DELETE SET NULL (author_id)

Produce an= identical outcome.

The absence of a column list on th= e former causes the system to look at the primary key for the named table a= nd use its column list - which is (tenant_id, user_id), same as the later e= xplicit version.

David J.

--000000000000c0bd8b064f814e7e--