From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Marko Tiikkaja <marko(at)joh(dot)to> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Add numeric_trim(numeric) |
Date: | 2015-12-27 07:11:50 |
Message-ID: | CAFj8pRBLriSg0F=kV72uVx_0ab6P1TcbP4gOdGhBdFL8QeYhww@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
2015-12-26 21:44 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> Hi
>
> 2015-11-19 3:58 GMT+01:00 Marko Tiikkaja <marko(at)joh(dot)to>:
>
>> Hi,
>>
>> Here's a patch for the second function suggested in
>> 5643125E(dot)1030605(at)joh(dot)to(dot) This is my first patch trying to do anything
>> with numerics, so please be gentle. I'm sure it's full of stupid.
>>
>> January's commit fest, feedback welcome, yada yada..
>>
>
> I am looking on this patch and I don't understand to formula
>
> dscale = (ndigits - arg.weight - 1) * DEC_DIGITS;
>
> the following rule is valid
>
> DEC_DIGITS * ndigits >= dscale + arg.weight + 1
>
> so dscale should be calculated like
>
> dscale <= DEC_DIGITS * ndigits - arg.weight - 1
>
> ?
>
> but your formula is correct and working. Can you explain it?
>
I understand to it now. I didn't catch the semantic of arg.weight well.
So I am sending a review of this patch.
1. There is not any objection against this feature. I am thinking so it is
good idea, and this mechanism can be used more often in other routines by
default. But it is different topic.
2. The implementation is simple, without any possible side effects,
performance impacts, etc
3. The patch is clean, small, it does what is expected.
4. There is good enough doc and regress tests
5. The patch respects PostgreSQL formatting - original version is maybe too
compact, I am sending a little bit edited code with few more empty lines.
6. All regress tests was passed
I'll mark this patch as ready for commiter
Regards
Pavel
>
> Regards
>
> Pavel
>
>
>
>
>
>
>>
>>
>> .m
>>
>
>
Attachment | Content-Type | Size |
---|---|---|
numeric-trim-02.patch | text/x-patch | 9.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2015-12-27 14:53:22 | Re: Check for interrupts in bf and xdes crypt() |
Previous Message | Vladimir Sitnikov | 2015-12-27 06:44:38 | Re: [POC] FETCH limited by bytes. |