## vod vos (vodvos@zoho.com):
> 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?
testing=# CREATE TABLE test (
id SERIAL,
goose NUMERIC(4,1),
CHECK (goose >= 100 OR goose <= -100)
);
CREATE TABLE
testing=# INSERT INTO test (goose) VALUES (300.2);
INSERT 0 1
testing=# INSERT INTO test (goose) VALUES (30.2);
ERROR: new row for relation "test" violates check constraint "test_goose_check"
DETAIL: Failing row contains (2, 30.2).
testing=# INSERT INTO test (goose) VALUES (-300.2);
INSERT 0 1
testing=# INSERT INTO test (goose) VALUES (-30.2);
ERROR: new row for relation "test" violates check constraint "test_goose_check"
DETAIL: Failing row contains (4, -30.2).
Regards,
Christoph
--
Spare Space