Re: WIP: Relaxing the constraints on numeric scale - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: WIP: Relaxing the constraints on numeric scale
Date
Msg-id CAEZATCWYwOj6fUqdyXrbRLt+9bsyUzVSeMUB+awPmWhxmk6tog@mail.gmail.com
Whole thread Raw
In response to Re: WIP: Relaxing the constraints on numeric scale  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: WIP: Relaxing the constraints on numeric scale  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Attached is a more complete patch, with updated docs and tests.

I chose to allow the scale to be in the range -1000 to 1000, which, to
some extent, is quite arbitrary. The upper limit of 1000 makes sense,
because nearly all numeric computations (other than multiply, add and
subtract) have that as their upper scale limit (that's the maximum
display scale). It also has to be at least 1000 for SQL compliance,
since the precision can be up to 1000.

The lower limit, on the other hand, really is quite arbitrary. -1000
is a nice round number, giving it a certain symmetry, and is almost
certainly sufficient for any realistic use case (-1000 means numbers
are rounded to the nearest multiple of 10^1000).

Also, keeping some spare bits in the typemod might come in handy one
day for something else (e.g., rounding mode choice).

Regards,
Dean

Attachment

pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: Synchronous commit behavior during network outage
Next
From: Yura Sokolov
Date:
Subject: Re: rand48 replacement