NOT NULL CHECK (mycol !='') :good idea? bad idea?

Поиск
Список
Период
Сортировка
От Michael Moore
Тема NOT NULL CHECK (mycol !='') :good idea? bad idea?
Дата
Msg-id CACpWLjPX-_80aXcJFbk7wxZWKPTs2Fyeywe=6HmgorzV2U=n7A@mail.gmail.com
обсуждение исходный текст
Ответы Re: NOT NULL CHECK (mycol !='') :good idea? bad idea?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: NOT NULL CHECK (mycol !='') :good idea? bad idea?  (David W Noon <david.w.noon@googlemail.com>)
Список pgsql-sql
In Oracle, a NOT NULL constraint on a table column of VARCHAR in essence says: "You need to put at least 1 character for a value". There is no such thing as a zero-length string in Oracle, it's either NULL or it has some characters. 

To make Postgres perform an equivalent column edit, I am considering defining table columns like  ... mycol VARCHAR(20) NOT NULL CHECK (mycol !='')

Is there any drawback to this? Is there a better way to do it? Any thoughts? how about ....
mycol VARCHAR(20) NOT NULL CHECK (length(mycol) > 0)
or even
mycol VARCHAR(20)                   CHECK (length(mycol) > 0)

tia,
Mike

В списке pgsql-sql по дате отправления:

Предыдущее
От: Michael Moore
Дата:
Сообщение: Re:
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: NOT NULL CHECK (mycol !='') :good idea? bad idea?