Re: [GENERAL] How to define the limit length for numeric type?
От
vod vos
Тема
Re: [GENERAL] How to define the limit length for numeric type?
Дата
Msg-id
15ac151f4c1.11fd07a0413606.5085131180687648249@zoho.com
Ответ на
Re: [GENERAL] How to define the limit length for numeric type? (Pavel Stehule)
Список
Дерево обсуждения
[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? "Charles Clavadetscher" <clavadetscher@swisspug.org>
Re: [GENERAL] How to define the limit length for numeric type? rob stone <floriparob@gmail.com>
Re: [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? "Charles Clavadetscher" <clavadetscher@swisspug.org>
Re: [GENERAL] How to define the limit length for numeric type? "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] How to define the limit length for numeric type? Christoph Moench-Tegeder <cmt@burggraben.net>
Re: [GENERAL] How to define the limit length for numeric type? Pavel Stehule <pavel.stehule@gmail.com>
Re: [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? "Charles Clavadetscher" <clavadetscher@swisspug.org>
Re: [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? Adrian Klaver <adrian.klaver@aklaver.com>
Re: [GENERAL] How to define the limit length for numeric type? "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] How to define the limit length for numeric type? Tom Lane <tgl@sss.pgh.pa.us>
Re: [GENERAL] How to define the limit length for numeric type? Pavel Stehule <pavel.stehule@gmail.com>
Re: [GENERAL] How to define the limit length for numeric type? "David G. Johnston" <david.g.johnston@gmail.com>
Maybe CHECK (goose >= 100 AND goose <= -100) works better, But if : INSERT INTO test VALUES (1, 59.2); INSERT INTO test VALUES (1, 59.24); INSERT INTO test VALUES (1, 59.26); INSERT INTO test VALUES (1, 59.2678); The INSERT action still can be done. What I want is just how to limit the length of the insert value, you can just type format like 59.22, only four digits length. Thank you. ---- On 星期六, 11 三月 2017 22:25:19 -0800 Pavel Stehule wrote ---- > > > 2017-03-12 7:14 GMT+01:00 vod vos : > > 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 TABLETime: 351,066 mspostgres=# insert into test values(1,3.2);INSERT 0 1Time: 65,997 mspostgres=# select * from test;┌────┬───────┐│ id │ goose │╞════╪═══════╡│ 1 │ 3.2 │└────┴───────┘(1 row)Time: 68,022 ms > Regards > Pavel > Thank you. > > > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > >
В списке pgsql-general по дате отправления
От: David G. Johnston
Дата:
От: David G. Johnston
Дата: