I can't release all of it, but the functions to convert uint64_t, int64_t and double to numeric Datum are the meat and I can expose those...
https://labs.omniti.com/pgsoltools/trunk/contrib/scratch/pg_type_to_numeric.c As I mentioned, the dscale on the double_to_numeric is imperfect resulting in things like: 1.23 turning into 1.2300 in the numeric returned. This are significantly faster (as expected) than the type -> string -> numeric conversions. On Mar 3, 2010, at 5:01 AM, Yeb Havinga wrote: > Theo Schlossnagle wrote: >> I didn't look deeply at the postgres internals to see if there was a way to >> do double -> numeric and integer-types -> numeric without intermediary >> string format. If that sort of thing is easy to leverage, I'd be happy to >> share the code. >> > I think your code could be valuable for postgres on the fact alone that it is > almost twice as fast, and probably easy to integrate and unit test. We make > heavy use of the numeric data type, so I'm very interested! > > regards > Yeb Havinga > > -- Theo Schlossnagle http://omniti.com/is/theo-schlossnagle -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers