Re: [GENERAL] How to define the limit length for numeric type? - Mailing list pgsql-general

From David G. Johnston
Subject Re: [GENERAL] How to define the limit length for numeric type?
Date
Msg-id CAKFQuwY13e6xHZAnB7r53GExarsOJqgR=4fbaN8Qj5ECwyYk6g@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] How to define the limit length for numeric type?  (vod vos <vodvos@zoho.com>)
List pgsql-general
On Mon, Mar 13, 2017 at 7:51 AM, vod vos <vodvos@zoho.com> wrote:
Sorry for taking varchar(4) as an example, What I want urgently is how to make a constraint of fixed length of a numeric data,
that you can only input data like 23.45,  and if you input the data like 2.45, 23.4356, 233.45, you will get a warning
message from postgresql.

I think expr will do the job, but are there any simpler ways to do it in postgresql?

​Requiring a fixed length, and not an amount range is unusual.  That the only way to do it is to consider the input as text and use a regular expression is understandable.

David J.​

pgsql-general by date:

Previous
From: "Charles Clavadetscher"
Date:
Subject: Re: [GENERAL] How to define the limit length for numeric type?
Next
From: Schmid Andreas
Date:
Subject: [GENERAL] createuser: How to specify a database to connect to