Re: [HACKERS] dividing money by money

2010-07-17 Thread Andy Balholm
On Jul 17, 2010, at 3:20 AM, Peter Eisentraut wrote:

 On fre, 2010-07-16 at 10:31 -0400, Tom Lane wrote:
 The other argument that I found convincing was that if the
 operator was defined to yield numeric, people might think that
 the result was exact ... which of course it won't be, either way.
 Choosing float8 helps to remind the user it's an approximate quotient.
 
 Why is it approximate?  Aren't money values really integers?

$1.00 / 3.00 = 0....

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] dividing money by money

2010-07-16 Thread Andy Balholm
On Jul 15, 2010, at 7:25 PM, Tom Lane wrote:

 * I didn't like this bit in cash_numeric():
 
   result-n_sign_dscale = NUMERIC_SIGN(result) | fpoint;
 
 Not only is that unwarranted chumminess with the implementation of
 numeric, it's flat-out wrong.  If the result isn't exactly the right
 number of digits (say, it's 12.3399 instead of the desired 12.34)
 this just hides the extra digits, it doesn't make the result correct.
 The right way is to use numeric_round(), which not only sets the dscale
 where we want it but rounds off any inaccuracy that might have crept in
 from the division.

Sorry about that. Is there documentation anywhere for backend functions and 
types? I couldn't find any, so I just looked through numeric.h to see what 
looked like it might work. I didn't find numeric_round, since it's declared in 
builtins.h.
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] dividing money by money

2010-06-21 Thread Andy Balholm
On Jun 21, 2010, at 11:47 AM, Kevin Grittner wrote:

 Yes, although the line endings are Windows format (CR/LF).  

The line endings must have gotten changed in transit. My original diff used 
just LF. I made it on a Mac.

 The only issue is with the general guideline to make the new code
 blend in with existing code:
 
 http://wiki.postgresql.org/wiki/Submitting_a_Patch
 
 | Generally, try to blend in with the surrounding code.
 
 | Comments are for clarification not for delineating your code from
 | the surroundings.
 
 There are comments to set off the new code, and some of the new DATA
 lines (and similar) are separated away from where one would expect
 them to be if they had been included with the rest.  Moving a few
 lines and deleting a few comment lines would resolve it.

I deleted the excess comments and moved some lines around. Here it is with the 
changes.


dividing-money.diff
Description: Binary data

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] ANNOUNCE list (was Re: New PGXN Extension site)

2010-06-17 Thread Andy Balholm
Marc Fournier wrote:
 But, I think you and I are exceptions here, in that we use the web interface 
 for moderation, and not just email ...

Is it possible that the ones that use email for moderating the lists have 
aggressive spam filters? Then they might not receive most of the list postings 
that should be rejected…

(I don't really know how the list-moderating system works, but this occurred to 
me as a possibility.)
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] dividing money by money

2010-06-01 Thread Andy Balholm
Thanks for the explanation of CommitFests.

 On May 30, 2010, at 6:53 AM, Kevin Grittner wrote:
 You would then generate a diff in context format and post to the
 -hackers list with that file as an attachment.  

I made my diff with src/tools/make_diff, as suggested in the Developer FAQ. But 
using git diff would be less hassle. Do the diffs from git diff work just as 
well?
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] dividing money by money

2010-05-31 Thread Andy Balholm
On May 30, 2010, at 6:53 AM, Kevin Grittner wrote:
 You would then generate a diff in context format and post to the
 -hackers list with that file as an attachment.  

Here it is:

dividing-money.diff
Description: Binary data

 Don't forget to add
 it to the CommitFest page:
 
 https://commitfest.postgresql.org/action/commitfest_view/open

I can't add it to the CommitFest page, since I don't have web access, just 
e-mail. Could you please take care of that part? (What is the CommitFest page, 
anyway?)
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] dividing money by money

2010-05-30 Thread Andy Balholm
On May 30, 2010, at 6:53 AM, Kevin Grittner wrote:
 You would basically move the functions and their prototypes to cash.c
 and cash.h, and then (instead of CREATE FUNCTION, etc.) add
 corresponding entries to pg_proc.h and pg_operator.h.  (If I'm
 missing something, someone please jump in.) Of course there's the
 issue of adding the new operators to the documentation, too.

How do I come up with OID numbers for my new operators and functions?

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [BUGS] dividing money by money

2010-05-28 Thread Andy Balholm
I'm not quite sure how to go about changing it from an add-on function to a 
built-in one. So if you want to do that, go ahead. If you'd rather I did, just 
tell me how it's done.

Andy Balholm
(509) 276-2065
a...@balholm.com

On May 26, 2010, at 11:18 AM, Kevin Grittner wrote:

 Hi Andy,
 
 Do you want to package this up as a patch for 9.1?  If not, is it OK
 if I do?
 
 -Kevin


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers