- pgaql long value corrupted using htons

From: Neeraj Rai <rneeraj(at)yahoo(dot)com>
To: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: - pgaql long value corrupted using htons
Date: 2013-05-22 23:52:13
Message-ID: 1369266733.72536.YahooMailNeo@web164902.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces

Hi,

1. I am having trouble writing long values via c interface .testlibqp-dt.c  is attached.
. 2 is being inserted as 8589934592.

qsf=> select * from t1;
   curdate   |  strf  |        intf        |         tm_new         | txnid 
------------+--------+--------------------+------------------------+-------
1999-01-10 | hello2 |8589934592 | 1999-01-08 04:05:06-05 |     3

I tried htobe64 but that didn't help either.
Any advise would be appreciated.

2. I have switched to using string for data and timestamp and it seems to work.

I found functions like TimestampTzGetDatum,time_t_to_timestamptz in the code 
But it seems they are not exposed to interface.
I have the date time in unix format (via time and gettimeofday). I would prefer to pass those values
in binary, rather than string format. Is there any option to do this ? Or is it easily addable?

thanks
Neeraj

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neeraj Rai 2013-05-22 23:55:03 Re: - pgaql long value corrupted using htons
Previous Message Heikki Linnakangas 2013-05-22 22:26:29 Re: [pgeu-general] Replication failover

Browse pgsql-interfaces by date

  From Date Subject
Next Message Neeraj Rai 2013-05-22 23:55:03 Re: - pgaql long value corrupted using htons
Previous Message Neeraj Rai 2013-05-22 16:52:10 Re: - pgaql binary data date time fornats