Skip site navigation (1) Skip section navigation (2)

8.3devel BUG with Cash send and recv

From: Andrew Chernow <ac(at)esilo(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>
Subject: 8.3devel BUG with Cash send and recv
Date: 2007-08-19 20:10:09
Message-ID: 46C8A3A1.9010203@esilo.com (view raw or flat)
Thread:
Lists: pgsql-bugs
There is what looks like a bug in 8.3devel.  When getting the money type in 
binary format from a libpq client, the below error is thrown from the backend:

ERROR:  unsupported integer size 8

It appears that the Cash typedef, defined in include/utils/cash.h, has changed 
to an int64 (previously an int32).  The cash_send and cash_recv functions, in 
backend/utils/adt/cash.c, are still calling pq_sendint and pq_getmsgint.

I tested on an 8.2rc box and that did not suffer from this issue because it uses 
a 32-bit Cash type.

Below is a test to reproduce the issue.

create table money_test (amount money);
insert into money_test values ('13.85');

/* libpq test code (breaks on 8.3devel, works on 8.2rc) */
#include <libpq-fe.h>
#include <stdio.h>

int main(void)
{
   PGresult *res;
   PGconn *conn = PQconnectdb("hostaddr=127.0.0.1  user=postgres");

   if(PQstatus(conn) != CONNECTION_OK)
   {
     printf("connection failure\n");
     return 1;
   }

   res = PQexecParams(
     conn,
     "SELECT amount FROM money_test LIMIT 1",
     0,
     (const Oid *)NULL,
     (const char * const *)NULL,
     (const int *)NULL,
     (const int *)NULL,
     1); /* binary */

   printf("tuples=%d, err=%s, res_err=%s\n",
     PQntuples(res),
     PQerrorMessage(conn),
     PQresultErrorMessage(res));

   PQclear(res);
   PQfinish(conn);
   return 0;
}

andrew

pgsql-bugs by date

Next:From: Hiroshi SaitoDate: 2007-08-20 01:39:35
Subject: Re: reindexdb in Windows
Previous:From: Ruediger KemmlerDate: 2007-08-19 19:51:05
Subject: BUG #3556: Installroutine hides destination folder

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group