Re: not null constraints, again - Mailing list pgsql-hackers

From jian he
Subject Re: not null constraints, again
Date
Msg-id CACJufxEKuRzYjHbdA4f61-xiWJp9v_sgNf3TYBqywiK_xNxjUw@mail.gmail.com
Whole thread Raw
In response to Re: not null constraints, again  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
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;
                        }



pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: promote request not received timely on slow Windows machines
Next
From: jian he
Date:
Subject: Re: not null constraints, again