pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Cary B. O'Brien <cobrien@access.digex.net>
To: ken@ori-ind.com
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] how to obtain column info
Date: Tue, 10 Nov 1998 20:34:47 -0500 (EST)
Message-ID: <199811110134.UAA07958@access1.digex.net> (raw)
In-Reply-To: <3.0.1.32.19981110163802.007b72f0@ori-ind.com>

> With libpq, how do you obtain column info (like type) for a table *before*
> returning a result set? For instance, knowing the column type before
> constructing an insert statement. A date will need quotes, a number won't,
> a string will, etc.
> 

I usually do a 'select * from table_x where oid < 0' or something like
that to get an empty result set.  This might be a stupid thing to do on
a big table, thought.  You might want to select a column with an index.
Anyone have a better idea?

Actually, you should be able to get the information out of the pg_ tables.

-- cary



view thread (5+ messages)  latest in thread

Message-ID: <199811110134.UAA07958@access1.digex.net>
Permalink:  ../199811110134.UAA07958@access1.digex.net/
Also on:    postgresql.org/message-id/199811110134.UAA07958@access1.digex.net

 · 

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: cobrien@access.digex.net, ken@ori-ind.com
  Subject: Re: [INTERFACES] how to obtain column info
  In-Reply-To: <199811110134.UAA07958@access1.digex.net>

* 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