pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: jian he <jian.universality@gmail.com>
Cc: Priyank Rajvansh <rajvansh.priyank@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: error in the example given for numeric data types
Date: Sat, 15 Jul 2023 09:16:41 -0400
Message-ID: <3579168.1689427001@sss.pgh.pa.us> (raw)
In-Reply-To: <CACJufxHA0e+cdpifou2LNwSVnVhMVC_kd17n8wn8BCcMv+4qUA@mail.gmail.com>
References: <167488510764.649.16865817209461558696@wrigleys.postgresql.org>
	<CAMyMXf2g1WaiQtoy7XtObTfCC+2WH1ZteGzbdhyx+4PwSiPGcA@mail.gmail.com>
	<CACJufxHA0e+cdpifou2LNwSVnVhMVC_kd17n8wn8BCcMv+4qUA@mail.gmail.com>

jian he <jian.universality@gmail.com> writes:
>> practice=# create table t1(height numeric(3,5));
>> ERROR:  NUMERIC scale 5 must be between 0 and precision 3

> it works in pg15, not in pg14.
> see my test: https://dbfiddle.uk/wgfjCx7j

Indeed. The quoted documentation text is different between v15 and prior
versions.  Observe also the v15 release notes:

https://www.postgresql.org/docs/15/release-15.html

    E.4.3.4. Data Types

        Allow the scale of a numeric value to be negative, or greater than
        its precision (Dean Rasheed, Tom Lane)

        This allows rounding of values to the left of the decimal point,
        e.g., '1234'::numeric(4, -2) returns 1200.


			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <3579168.1689427001@sss.pgh.pa.us>
Permalink:  ../3579168.1689427001@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3579168.1689427001@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jian.universality@gmail.com, rajvansh.priyank@gmail.com
  Subject: Re: error in the example given for numeric data types
  In-Reply-To: <3579168.1689427001@sss.pgh.pa.us>
  References: <167488510764.649.16865817209461558696@wrigleys.postgresql.org> <CAMyMXf2g1WaiQtoy7XtObTfCC+2WH1ZteGzbdhyx+4PwSiPGcA@mail.gmail.com> <CACJufxHA0e+cdpifou2LNwSVnVhMVC_kd17n8wn8BCcMv+4qUA@mail.gmail.com> <3579168.1689427001@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox