INTERVAL data type and libpq - what format?

From: Sebastien FLAESCH <sf(at)4js(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: mmoncure(at)gmail(dot)com
Subject: INTERVAL data type and libpq - what format?
Date: 2009-05-19 08:08:37
Message-ID: 4A126905.4040504@4js.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hello,

I try to use the new 8.4 INTERVAL type with libpq, but get crazy with
the input formatting rules...

I use PQprepare() / PQexecPrepared() with parameter list, binding the
INTERVAL values with the 1186 pg_type and passing a string buffer with
values like:

"12345" for an INTERVAL YEAR

The INSERT works without error, but when selecting rows from the table
in psql, I get "00:00:00" values ?!?!

When inserting the value "12345" from the psql command tool it works...

I must be doing something wrong, but I could not find any documentation
on using INTERVAL in libpq...

Can someone from the hackers just tell me if it's supposed to work and
if yes what format is expected by the client library?

Attached, you have a test case to reproduce the problem.

Thanks a lot!
Seb

Attachment Content-Type Size
libpqtest1.c text/plain 3.8 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scara Maccai 2009-05-19 08:30:32 how the planner decides between bitmap/index scan
Previous Message kelvin273 2009-05-19 08:03:29 my insertion script don't work

Browse pgsql-hackers by date

  From Date Subject
Next Message Sebastien FLAESCH 2009-05-19 08:39:20 INTERVAL SECOND limited to 59 seconds?
Previous Message Tom Lane 2009-05-19 03:25:21 Re: Show method of index