check constraint on char field

Поиск
Список
Период
Сортировка
От Robert Fitzpatrick
Тема check constraint on char field
Дата
Msg-id 1086799372.3458.70.camel@columbus
обсуждение исходный текст
Ответы Re: check constraint on char field  ("Scott Marlowe" <smarlowe@qwest.net>)
Список pgsql-general
I have a field in my pgsql 7.4.2 table that is char(6) type. This holds
an ID that contains only numbers, but must be six characters in length.
First two chars are the year followed by a sequential number. For
instance, a number entered for the time this year would be '040001'. I
was trying to setup a check constraint to make sure only number were
used, this is what I have, but it is allowing alphanumerics:

projectno >= '000000' AND projectno <= '999999'

Or maybe just a trigger to create the number itself would be better?

--
Robert


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

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: postgres on SuSE 9.1
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: replication