pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: ::Willi the One:: <sonic_and_tails2000@yahoo.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Retrieving timestamp data
Date: Sun, 4 Mar 2007 10:23:55 -0700
Message-ID: <20070304172355.GA38897@winnie.fuhr.org> (raw)
In-Reply-To: <20070304152310.95205.qmail@web36709.mail.mud.yahoo.com>
References: <20070304152310.95205.qmail@web36709.mail.mud.yahoo.com>

On Sun, Mar 04, 2007 at 07:23:10AM -0800, ::Willi the One:: wrote:
> In the documentation, it says that PQgetvalue()
> returns string values for strings and "the value is in
> the binary representation determined by the data
> type’s typsend and typreceive functions."

You've omitted part of what the documentation says.  The complete
text is:

  For data in text format, the value returned by PQgetvalue is a
  null-terminated character string representation of the field
  value.  For data in binary format, the value is in the binary
  representation determined by the data type's typsend and typreceive
  functions.

> The problem is, where's the typsend and typrecieve located?

In the backend.  You can find out which functions they are by
querying pg_type, and you can learn more about the functions
themselves by querying pg_proc and by examining the source code.
But you should only need to do this if you need query results in
binary format.  Do you?

> For example, if I want to retrieve a timestamp data,
> how would I do it? Will it return as a string when I
> call PQgetvalue()? What about other types such Points
> or inet types?

Unless you request results in binary format all values will be
returned as text strings.  What happened when you tried it?  Are
you requesting results in binary format?

-- 
Michael Fuhr



view thread (6+ messages)  latest in thread

Message-ID: <20070304172355.GA38897@winnie.fuhr.org>
Permalink:  ../20070304172355.GA38897@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20070304172355.GA38897@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: mike@fuhr.org, sonic_and_tails2000@yahoo.com
  Subject: Re: Retrieving timestamp data
  In-Reply-To: <20070304172355.GA38897@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox