Thread: DOMAIN constraints bug or feature

DOMAIN constraints bug or feature

From
Viacheslav N Tararin
Date:
Hi.

Have next problem DOMAIN constraints ommited in table definition.

--- TEST FILE ---
create domain ID_DOMAIN      integer      not null;
create table test (
    ID    ID_DOMAIN,
    NOTES text      NOT NULL
);

\d test;

alter table test add constraint test_pk primary key (ID);

--- OUTPUT ---
CREATE DOMAIN
CREATE TABLE
      Table "public.test"
 Column |   Type    | Modifiers
--------+-----------+-----------
 id     | id_domain |
 notes  | text      | not null

psql:test.sql:9: ERROR:  Existing attribute "id" cannot be a PRIMARY KEY
because it is not marked NOT NULL
---

Why NOT NULL modifier for ID_DOMAIN not present in the test table
definition?

Thanks