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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: vod vos <vodvos(at)zoho(dot)com>
Cc: rob stone <floriparob(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to define the limit length for numeric type?
Date: 2017-03-13 15:09:15
Message-ID: CAKFQuwY13e6xHZAnB7r53GExarsOJqgR=4fbaN8Qj5ECwyYk6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 13, 2017 at 7:51 AM, vod vos <vodvos(at)zoho(dot)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.​

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Schmid Andreas 2017-03-13 15:29:48 createuser: How to specify a database to connect to
Previous Message Charles Clavadetscher 2017-03-13 15:06:31 Re: How to define the limit length for numeric type?