pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Jungwirth <pj@illuminatedcomputing.com>
To: pgsql-hackers@lists.postgresql.org
Subject: Re: PERIOD foreign key feature
Date: Tue, 7 May 2024 09:43:58 -0700
Message-ID: <4a630353-11bb-4e3a-ae61-5ec10abe7aed@illuminatedcomputing.com> (raw)
In-Reply-To: <CAKFQuwZZObJj964eRkw6=kEEA3S_WQiz4Z+r4kk_yEaH9-r_tw@mail.gmail.com>
References: <ZjpApuq8I9DE5Elv@momjian.us>
	<CAKFQuwZZObJj964eRkw6=kEEA3S_WQiz4Z+r4kk_yEaH9-r_tw@mail.gmail.com>

On 5/7/24 08:23, David G. Johnston wrote:
> On Tue, May 7, 2024 at 7:54 AM Bruce Momjian <bruce@momjian.us <mailto:bruce@momjian.us>> wrote:
>     In the two marked lines, it says "if one side of the foreign key uses
>     PERIOD, the other side must too."  However, looking at the example
>     queries, it seems like if the foreign side has PERIOD, the primary side
>     must have WITHOUT OVERLAPS, not PERIOD.
> 
>     Does this doc text need correcting?
> 
> 
> The text is factually correct, though a bit hard to parse.
> 
> "the other side" refers to the part after "REFERENCES":
> 
> FOREIGN KEY ( column_name [, ... ] [, PERIOD column_name ] ) REFERENCES reftable [ ( refcolumn [, 
> ... ] [, PERIOD column_name ] ) ]
> 
> ***(shouldn't the second occurrence be [, PERIOD refcolum] ?)
> 
> The text is pointing out that since the refcolumn specification is optional you may very well not 
> see a second PERIOD keyword in the clause.  Instead it will be inferred from the PK.
> 
> Maybe:
> 
> Finally, if the foreign key has a PERIOD column_name specification the corresponding refcolumn, if 
> present, must also be marked PERIOD.  If the refcolumn clause is omitted, and thus the reftable's 
> primary key constraint chosen, the primary key must have its final column marked WITHOUT OVERLAPS.

Yes, David is correct here on all points. I like his suggestion to clarify the language here also. 
If you need a patch from me let me know, but I assume it's something a committer can just make happen?

Yours,

-- 
Paul              ~{:-)
pj@illuminatedcomputing.com





view thread (7+ messages)  latest in thread

Message-ID: <4a630353-11bb-4e3a-ae61-5ec10abe7aed@illuminatedcomputing.com>
Permalink:  ../4a630353-11bb-4e3a-ae61-5ec10abe7aed@illuminatedcomputing.com/
Also on:    postgresql.org/message-id/4a630353-11bb-4e3a-ae61-5ec10abe7aed@illuminatedcomputing.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pj@illuminatedcomputing.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: PERIOD foreign key feature
  In-Reply-To: <4a630353-11bb-4e3a-ae61-5ec10abe7aed@illuminatedcomputing.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox