ECPG Segmentation fault on retreiving timestamp column into sqlda.

From: "Day, David" <dday(at)redcom(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: ECPG Segmentation fault on retreiving timestamp column into sqlda.
Date: 2011-09-26 18:42:03
Message-ID: 401084E5E73F4241A44F3C9E6FD79428109F34FC@exch-01.redcom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

If I am retrieving row(s) into a sql descriptor in ECPG, and my last row column is of type timestamp, then I I will consistently receive a segmentation fault as shown below. If I redefine the table so that the timestamp field is not the last field of the table row, the routine runs successfully.
This seems like a bug to me that I will work around by not having a timestamp column as my last column.

I'd put it in the bug category but I am fairly new to postgres so would like to see if there other thoughts on the observation.

I am using ubuntu 10.04 with Postgres V 9.03.

Tnx

Dave

Here is the relavant logic in my ecpg file:

EXEC SQL AT :cid PREPARE ps_registersipusr FROM
"SELECT * FROM RegisterSipUser(?, ?, ?, ?, ?, ?)";

sqlda_t* sqlda = NULL;

97 EXEC SQL AT :cid DECLARE cur_regsip CURSOR FOR ps_registersipusr;
98 EXEC SQL AT :cid OPEN cur_regsip USING :portid, :callid, :contact, :uri, :seq, :expiration;
99 EXEC SQL AT :cid FETCH ALL FROM cur_regsip INTO DESCRIPTOR sqlda;

Here is the distilled down dump received when the expiration/timestamp data type column is my last column in the row.

[21304]: ecpg_execute on line 98: using PQexecParams
..
[21304]: ecpg_execute on line 99: correctly got 2 tuples with 6 fields
[..
[21304]: ecpg_set_native_sqlda on line 99 row 1 col 5 IS NOT NULL
..
[21304]: ecpg_set_native_sqlda on line 99 row 0 col 5 IS NOT NULL
[21304]: ecpg_get_data on line 99: RESULT: 2000-01-01 00:21:56.639667 offset: 0; array: no
[21304]: ecpg_execute on line 99: putting result (1 tuple 6 fields) into sqlda descriptor
*** glibc detected *** /space/dday/av/debug/i686-pc-linux-gnu/bin/dbm: double free or corruption (out):

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2011-09-26 18:47:06 Re: "all" not inclusive of "replication" in pg_hba.conf
Previous Message Rich Shepard 2011-09-26 18:38:16 Quick-and-Dirty Data Entry with LibreOffice3?