From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | vod vos <vodvos(at)zoho(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to define the limit length for numeric type? |
Date: | 2017-03-12 06:59:36 |
Message-ID: | CAKFQuwbygDxCBnVgAWdF=mzO70PM6uUiLCQJgkdNV0QhfCUB3w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, Mar 11, 2017 at 11:14 PM, vod vos <vodvos(at)zoho(dot)com> wrote:
>
> Hi everyone,
>
> How to define the exact limit length of numeric type? For example,
>
> CREATE TABLE test (id serial, goose numeric(4,1));
>
> [...]
> 30.2 can be inserted into COLUMN goose, but I want 30.2
> [...]
> can not be inserted, how to do this?
>
Not possible to both allow and disallow the same value (30.2) ...
A check constraint is "how" you define additional limitation on the data -
but you'll need to figure out where the logic flaw (or typo) came from.
https://www.postgresql.org/docs/9.6/static/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | vod vos | 2017-03-12 07:00:58 | Re: How to define the limit length for numeric type? |
Previous Message | Pavel Stehule | 2017-03-12 06:25:56 | Re: How to define the limit length for numeric type? |