Hi.
I noticed that it seems to me a mistake in the sample code in the
document.
https://www.postgresql.org/docs/devel/ddl-constraints.html#DDL-CONSTRAINTS-FK
I think it is a typo for user_id instead of author_id.
See bellow.
Best reghards,
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 898b6dd..c0de169 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -1269,9 +1269,9 @@ CREATE TABLE users (
CREATE TABLE posts (
tenant_id integer REFERENCES tenants ON DELETE CASCADE,
post_id integer NOT NULL,
- author_id integer,
+ user_id integer,
PRIMARY KEY (tenant_id, post_id),
- FOREIGN KEY (tenant_id, author_id) REFERENCES users ON DELETE SET
NULL <emphasis>(author_id)</emphasis>
+ FOREIGN KEY (tenant_id, user_id) REFERENCES users ON DELETE SET
NULL <emphasis>(user_id)</emphasis>
);
</programlisting>
Without the specification of the column, the foreign key would also
set