Adding "NOT NULL" Constraint with CREATE TABLE or ALTER TABLE
| От | Phillip J. Allen |
|---|---|
| Тема | Adding "NOT NULL" Constraint with CREATE TABLE or ALTER TABLE |
| Дата | |
| Msg-id | 3DEF6577.8030101@attglobal.net обсуждение исходный текст |
| Ответы |
Re: Adding "NOT NULL" Constraint with CREATE TABLE or ALTER TABLE
|
| Список | pgsql-novice |
Hi all, I have built my geology/mine database in Postgres and the front end in MS Access(I hate it too but still haven't decided on a good alternative). Now when I ported my dbf to Postgres I didn't put all the constraints and referencial integrety (relationships) into it so I am now going back through it and refining it. Now I am adding the "not null" constraints to various columns. I am adding them with the ALTER TABLE mytable ADD CONSTRAINT thekeyname_key CHECK (thefield IS NOT NULL);. When I do a \d+ thetable, psql returns the proper constraint and all works fine. But the constraint (not null) does not appear in the modifiers colunm of the \d+ command but below the column list as a Constraint. Is adding the not null constraint at the time of creating a table the same as adding a "constraint" later? If it is different is there a performance difference? Phillip J. Allen Consulting Geochemist/Geologist
В списке pgsql-novice по дате отправления: