Unix Technical Forum

Patch to correct 64-bit money type in 8.3devel

This is a discussion on Patch to correct 64-bit money type in 8.3devel within the Pgsql Patches forums, part of the PostgreSQL category; --> Attached is a patch for the 8.3devel 64-bit money type. Bug reported here: http://archives.postgresql.org/pgsql...8/msg00137.php . Run the test program ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 10:30 AM
Andrew Chernow
 
Posts: n/a
Default Patch to correct 64-bit money type in 8.3devel

Attached is a patch for the 8.3devel 64-bit money type. Bug reported
here: http://archives.postgresql.org/pgsql...8/msg00137.php.

Run the test program included in the bug report to see the issue. Then
apply patch and run the test again.

Andrew Chernow



Index: src/backend/utils/adt/cash.c
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/cash.c,v
retrieving revision 1.71
diff -c -C6 -r1.71 cash.c
*** src/backend/utils/adt/cash.c 12 Jul 2007 23:51:10 -0000 1.71
--- src/backend/utils/adt/cash.c 20 Aug 2007 14:10:44 -0000
***************
*** 369,394 ****
*/
Datum
cash_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);

! PG_RETURN_CASH((Cash) pq_getmsgint(buf, sizeof(Cash)));
}

/*
* cash_send - converts cash to
binary format
*/
Datum
cash_send(PG_FUNCTION_ARGS)
{
Cash arg1 = PG_GETARG_CASH(0);
StringInfoData buf;

pq_begintypsend(&buf);
! pq_sendint(&buf, arg1, sizeof(Cash));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}

/*
* Comparison functions
*/
--- 369,394 ----
*/
Datum
cash_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);

! PG_RETURN_CASH((Cash) pq_getmsgint64(buf));
}

/*
* cash_send - converts cash to
binary format
*/
Datum
cash_send(PG_FUNCTION_ARGS)
{
Cash arg1 = PG_GETARG_CASH(0);
StringInfoData buf;

pq_begintypsend(&buf);
! pq_sendint64(&buf, arg1);
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}

/*
* Comparison functions
*/

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 10:31 AM
Tom Lane
 
Posts: n/a
Default Re: Patch to correct 64-bit money type in 8.3devel

Andrew Chernow <ac@esilo.com> writes:
> Attached is a patch for the 8.3devel 64-bit money type. Bug reported
> here: http://archives.postgresql.org/pgsql...8/msg00137.php.


This message seems to have been whacked around by your mailer --- you
might try sending the patch as an attachment next time. Fortunately
it's a small enough patch to apply by hand, and I've done that.
Thanks for the report and fix!

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:57 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com