CREATE TABLE a (aa TEXT); CREATE TEMP TABLE z (b TEXT, UNIQUE(aa, b)) inherits (a);
\d+ z Table "pg_temp_0.z" Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description --------+------+-----------+----------+---------+----------+-------------+--------------+------------- aa | text | | not null | | extended | | | b | text | | | | extended | | | Indexes: "z_aa_b_key" UNIQUE CONSTRAINT, btree (aa, b) Not-null constraints: "z_aa_not_null" NOT NULL "aa" Inherits: a Access method: heap that means in transformIndexConstraint, the following part only apply to CONSTR_PRIMARY if (strcmp(key, inhname) == 0) { found = true; typid = inhattr->atttypid; cxt->nnconstraints = lappend(cxt->nnconstraints, makeNotNullConstraint(makeString(pstrdup(inhname)))); break; }