Re: Foreign Keys being able to reference same table not spelled out in documentation
maweki@gmail.com
From: maweki@gmail.com
To: "David G. Johnston" <david.g.johnston@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pg Docs <pgsql-docs@lists.postgresql.org>
Date: 2021-05-06T06:07:39Z
Lists: pgsql-docs
Note that it is in general not necessary for the referencing column to be NULLABLE. If you defer the constraint checking, you can insert a cyclic structure. Of course, it's no longer a tree then. The tutorial-ness of the documentation was already pointed out and I don't think it needs to be said there. We just would want to not imply this (nullable) would be necessary. Documentation-wise I liked to MariaDB approach very much, where the two tables were named "parent table" and "child table" and at some point you note that it is allowed for a table to be both. But this would be a lot more invasive. All the Best Mario Wenzel Am Mittwoch, dem 05.05.2021 um 21:17 -0700 schrieb David G. Johnston: > On Thu, Apr 29, 2021 at 10:33 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > I'm inclined to propose adding an example a little further down, as > > per the attached draft patch. This wouldn't help people who stop > > reading after the section's first sentence, but we can't cover > > everything in the first sentence. > > > > > > > Given the tutorial nature of this section I agree with the approach. > > I did a read through of the patch and I like it; though I suggest > changing "but non-NULL" to "while non-NULL". > > Thanks! > > David J. >
Commits
-
Doc: trivial wording adjustment.
- c38cadc0907a 14.0 landed
-
Doc: add an example of a self-referential foreign key to ddl.sgml.
- 8f65db5ecf9b 9.6.22 landed
- 7dcec3ed45d5 10.17 landed
- 4fd7c797672f 11.12 landed
- e6f9539dc324 14.0 landed
- bd9e46a1a4ac 12.7 landed
- 3eeadc425ccf 13.3 landed