7.1 (current) unwanted NOT NULL constraint inserted - Mailing list pgsql-hackers
From | Oliver Elphick |
---|---|
Subject | 7.1 (current) unwanted NOT NULL constraint inserted |
Date | |
Msg-id | 200012151753.eBFHrEr10390@linda.lfix.co.uk Whole thread Raw |
Responses |
Re: 7.1 (current) unwanted NOT NULL constraint inserted
Re: 7.1 (current) unwanted NOT NULL constraint inserted |
List | pgsql-hackers |
In the creation below, the column parent_id has ended up with a NOT NULL constraint that I didn't ask for and don't want. This is 7.1, updated today from cvs. ======================================================================= [... other tables created ...] CREATE TABLE person ( ptype SMALLINT, id CHAR(10), name TEXT NOT NULL, address INTEGER, salutation TEXT DEFAULT 'Dear Sir', envelope TEXT, email TEXT, www TEXT, CONSTRAINT person_ptypeCHECK (ptype >= 0 AND ptype <= 8) , PRIMARY KEY (id), FOREIGN KEY (id, address) REFERENCES address(person, id) ON UPDATE CASCADE ON DELETE RESTRICT ) NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'person_pkey' for table 'person' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) CREATE [... other tables created ...] CREATE TABLE organisation ( contact CHAR(10) REFERENCES individual (id) ON UPDATE CASCADE ON DELETE NO ACTION, structure CHAR(1) CHECK (structure='L' OR structure='C'OR structure='U' OR structure='O'), department TEXT, parent_id CHAR(10), CONSTRAINT dept_parent CHECK ((department IS NULL AND parent_id IS NULL) OR (department > '' AND parent_id > '')), CONSTRAINT organisation_ptype CHECK ((ptype >= 2 AND ptype <=4) OR ptype= 8) , PRIMARY KEY (id), FOREIGN KEY (id, address) REFERENCES address(person, id) ON UPDATE CASCADE ON DELETE RESTRICT ) INHERITS (person) NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'organisation_pkey' for table 'organisation' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) CREATE [... skip various COMMENT declarations ...] \d+ organisation Table "organisation"Attribute | Type | Modifier | Description ------------+---------------+--------------------+----------------------------- -ptype | smallint | |id | character(10) | not null | Identifiername | text | not null | Nameaddress | integer | | Primary address idsalutation| text | default 'Dear Sir' | Salutation in a letterenvelope | text | | Form of name on envelopeemail | text | | Email addresswww | text | | Web URLcontact | character(10) | | Id of primary contact personstructure | character(1) | | Legal structure codedepartment | text | | Name of this departmentparent_id | character(10) | not null | Parent organisation id Index: organisation_pkey Constraints: ((ptype >= 0) AND (ptype <= 8)) ((((structure = 'L'::bpchar) OR (structure = 'C'::bpchar)) OR (structure = 'U'::bpchar)) OR (structure = 'O'::bpchar)) (((department ISNULL) AND (parent_id ISNULL)) OR (((department> ''::text) AND (parent_id NOTNULL)) AND (parent_id > ''::bpchar))) (((ptype >= 2) AND (ptype <= 4)) OR (ptype =8)) ======================================================================= -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "The fear of the LORD is the instruction of wisdom, and before honour is humility." Proverbs 15:33
pgsql-hackers by date: