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

From: Pavel Stehule <pavel(dot)stehule(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:25:56
Message-ID: CAFj8pRBa3QokY_npCTLq0ytb2jmzC6-Yp_Z7ogct=0buLTkAmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2017-03-12 7:25 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

>
>
> 2017-03-12 7:14 GMT+01:00 vod vos <vodvos(at)zoho(dot)com>:
>
>>
>> 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?
>>
>
> ostgres=# CREATE TABLE test (id serial, goose numeric(4,1));
> CREATE TABLE
> Time: 351,066 ms
> postgres=# insert into test values(1,3.2);
> INSERT 0 1
> Time: 65,997 ms
> postgres=# select * from test;
> ┌────┬───────┐
> │ id │ goose │
> ╞════╪═══════╡
> │ 1 │ 3.2 │
> └────┴───────┘
> (1 row)
>
> Time: 68,022 ms
>
>
> Regards
>

sorry, I wrongly read a question

Pavel

>
> Pavel
>
>>
>> Thank you.
>>
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2017-03-12 06:59:36 Re: How to define the limit length for numeric type?
Previous Message Pavel Stehule 2017-03-12 06:25:19 Re: How to define the limit length for numeric type?