- pgaql long value corrupted using htons

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

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 am 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

Attachment Content-Type Size
testlibpq-dt.c text/x-csrc 3.1 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Ernst 2013-05-23 12:04:53 Re: VACUUM FULL freezes
Previous Message Wojciech Skaba 2013-05-23 09:40:37 update ARRAY of COMPOSITE TYPE of text

Browse pgsql-interfaces by date

  From Date Subject
Next Message Rene Grün 2013-05-24 14:42:21 Postgresql 9.0.8 - ECPG - COPY FROM returning COUNT
Previous Message David Patimer 2013-05-23 08:17:47 Building libpq for Windows 64bit