Dumb question about binary cursors and #ifdef HAVE_INT64_TIMESTAMP

Started by Dann Corbitabout 18 years ago5 messages
#1Dann Corbit
DCorbit@connx.com

If I create a binary cursor on a recent version of PostgreSQL, how can I
tell if the timestamp data internally is an 8 byte double or an 8 byte
integer?

I see an #ifdef that changes the code path to compute timestamps as one
type or the other, but I do not know how to recognize the internal
format of the type that will be returned in a binary cursor.

How can I do that?

#2Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Dann Corbit (#1)
Re: Dumb question about binary cursors and #ifdef HAVE_INT64_TIMESTAMP

Dann Corbit wrote:

If I create a binary cursor on a recent version of PostgreSQL, how can I
tell if the timestamp data internally is an 8 byte double or an 8 byte
integer?

I see an #ifdef that changes the code path to compute timestamps as one
type or the other, but I do not know how to recognize the internal
format of the type that will be returned in a binary cursor.

How can I do that?

SHOW integer_timestamp;

(actually, IIRC, this is one of the params that the server will send you
at session start).

--
Alvaro Herrera http://www.flickr.com/photos/alvherre/
"Y eso te lo doy firmado con mis l�grimas" (Fiebre del Loco)

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dann Corbit (#1)
Re: Dumb question about binary cursors and #ifdef HAVE_INT64_TIMESTAMP

"Dann Corbit" <DCorbit@connx.com> writes:

If I create a binary cursor on a recent version of PostgreSQL, how can I
tell if the timestamp data internally is an 8 byte double or an 8 byte
integer?

PQparameterStatus(conn, "integer_datetimes")

regards, tom lane

#4Dann Corbit
DCorbit@connx.com
In reply to: Alvaro Herrera (#2)
Re: Dumb question about binary cursors and #ifdefHAVE_INT64_TIMESTAMP

-----Original Message-----
From: Alvaro Herrera [mailto:alvherre@alvh.no-ip.org]
Sent: Tuesday, December 11, 2007 1:11 PM
To: Dann Corbit
Cc: pgsql-hackers@postgresql.org; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Dumb question about binary cursors and
#ifdefHAVE_INT64_TIMESTAMP

Dann Corbit wrote:

If I create a binary cursor on a recent version of PostgreSQL, how

can I

tell if the timestamp data internally is an 8 byte double or an 8

byte

integer?

I see an #ifdef that changes the code path to compute timestamps as

one

type or the other, but I do not know how to recognize the internal
format of the type that will be returned in a binary cursor.

How can I do that?

SHOW integer_timestamp;

(actually, IIRC, this is one of the params that the server will send

you

at session start).

I guess that I am supposed to check for error on the statement? What
does it look like when the query works?

This is what I get against PostgreSQL 8.2.5 using PG Admin III query
tool:

ERROR: unrecognized configuration parameter "integer_timestamp"

#5Dann Corbit
DCorbit@connx.com
In reply to: Alvaro Herrera (#2)
Re: Dumb question about binary cursors and #ifdefHAVE_INT64_TIMESTAMP

-----Original Message-----
From: Alvaro Herrera [mailto:alvherre@alvh.no-ip.org]
Sent: Tuesday, December 11, 2007 1:11 PM
To: Dann Corbit
Cc: pgsql-hackers@postgresql.org; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Dumb question about binary cursors and
#ifdefHAVE_INT64_TIMESTAMP

Dann Corbit wrote:

If I create a binary cursor on a recent version of PostgreSQL, how

can I

tell if the timestamp data internally is an 8 byte double or an 8

byte

integer?

I see an #ifdef that changes the code path to compute timestamps as

one

type or the other, but I do not know how to recognize the internal
format of the type that will be returned in a binary cursor.

How can I do that?

SHOW integer_timestamp;

(actually, IIRC, this is one of the params that the server will send

you

at session start).

Tom's post clued me in.
It's:
show integer_datetimes;

Or (in my case):
PQparameterStatus(conn, "integer_datetimes")