Re: WIP: Relaxing the constraints on numeric scale

2021-07-26 Thread Dean Rasheed
On Fri, 23 Jul 2021 at 16:50, Tom Lane wrote: > > OK, I've now studied this more closely, and have some additional > nitpicks: > > * I felt the way you did the documentation was confusing. It seems > better to explain the normal case first, and then describe the two > extended cases. OK, that

Re: WIP: Relaxing the constraints on numeric scale

2021-07-23 Thread Tom Lane
Dean Rasheed writes: > All your other suggestions make sense too. Attached is a new version. OK, I've now studied this more closely, and have some additional nitpicks: * I felt the way you did the documentation was confusing. It seems better to explain the normal case first, and then describe

Re: WIP: Relaxing the constraints on numeric scale

2021-07-22 Thread Dean Rasheed
On Wed, 21 Jul 2021 at 22:33, Tom Lane wrote: > > I took a brief look at this and have a couple of quick suggestions: > Thanks for looking at this! > * As you mention, keeping some spare bits in the typmod might come > in handy some day, but as given this patch isn't really doing so. > I think

Re: WIP: Relaxing the constraints on numeric scale

2021-07-21 Thread Tom Lane
Dean Rasheed writes: > Attached is a more complete patch, with updated docs and tests. I took a brief look at this and have a couple of quick suggestions: * As you mention, keeping some spare bits in the typmod might come in handy some day, but as given this patch isn't really doing so. I think

Re: WIP: Relaxing the constraints on numeric scale

2021-07-03 Thread Dean Rasheed
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

Re: WIP: Relaxing the constraints on numeric scale

2021-06-29 Thread Robert Haas
On Tue, Jun 29, 2021 at 4:46 PM Dean Rasheed wrote: > On Tue, 29 Jun 2021 at 21:34, Robert Haas wrote: > > I thought about this too, but > > http://postgr.es/m/774767.1591985...@sss.pgh.pa.us made me think that > > it would be an on-disk format break. Maybe it's not, though? > > No, because the

Re: WIP: Relaxing the constraints on numeric scale

2021-06-29 Thread Tom Lane
Robert Haas writes: > On Tue, Jun 29, 2021 at 3:58 PM Dean Rasheed wrote: >> When specifying NUMERIC(precision, scale) the scale is constrained to >> the range [0, precision], which is per SQL spec. However, at least one >> other major database vendor intentionally does not impose this >>

Re: WIP: Relaxing the constraints on numeric scale

2021-06-29 Thread Dean Rasheed
On Tue, 29 Jun 2021 at 21:34, Robert Haas wrote: > > I thought about this too, but > http://postgr.es/m/774767.1591985...@sss.pgh.pa.us made me think that > it would be an on-disk format break. Maybe it's not, though? > No, because the numeric dscale remains non-negative, so there's no change to

Re: WIP: Relaxing the constraints on numeric scale

2021-06-29 Thread Robert Haas
On Tue, Jun 29, 2021 at 3:58 PM Dean Rasheed wrote: > When specifying NUMERIC(precision, scale) the scale is constrained to > the range [0, precision], which is per SQL spec. However, at least one > other major database vendor intentionally does not impose this > restriction, since allowing

WIP: Relaxing the constraints on numeric scale

2021-06-29 Thread Dean Rasheed
When specifying NUMERIC(precision, scale) the scale is constrained to the range [0, precision], which is per SQL spec. However, at least one other major database vendor intentionally does not impose this restriction, since allowing scales outside this range can be useful. A negative scale implies