Re: [GENERAL] How to define the limit length for numeric type?

Поиск
Список
Период
Сортировка
От rob stone
Тема Re: [GENERAL] How to define the limit length for numeric type?
Дата
Msg-id 1489354133.8887.1.camel@gmail.com
обсуждение исходный текст
Ответ на [GENERAL] How to define the limit length for numeric type?  (vod vos <vodvos@zoho.com>)
Ответы Re: [GENERAL] How to define the limit length for numeric type?
Список pgsql-general
Hello,

On Sat, 2017-03-11 at 22:14 -0800, vod vos wrote:
> Hi everyone,
>
> How to define the exact limit length of numeric type? For example, 
>
> CREATE TABLE test  (id serial, goose numeric(4,1));
>
> 300.2 and 30.2 can be inserted into COLUMN goose, but I want 30.2 or
> 3.2 can not be inserted, how to do this?
>
> Thank you.
>
>
>


Assuming that column goose may only contain values ranging from 100.0
to 999.9, then a check constraint along the lines of:-

goose > 99.9 and < 1000

should do the trick.

HTH,
Rob


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

Предыдущее
От:
Дата:
Сообщение: [GENERAL] general erros backup
Следующее
От: Raffaele Irlanda
Дата:
Сообщение: [GENERAL] PostgreSQL general discussions list - 2010 Thread: Wikipedia entry -AmigaOS port - error?