Skip site navigation (1) Skip section navigation (2)

Is there a way to describe precision and scale for columns in a select statement using libpq?

From: Brijesh Shrivastav <Bshrivastav(at)esri(dot)com>
To: "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Is there a way to describe precision and scale for columns in a select statement using libpq?
Date: 2004-06-03 17:39:10
Message-ID: 491DC5F3D279CD4EB4B157DDD62237F401ADE45E@zipwire.esri.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
Hi! All,

I am a new postgres developer and as is the case with many of us I am
porting
an existing application to postgres database. One of the requirement for us
is to be able to determine the scale and precision for select columns so we
can
accordingly allordingly allocate memory or inform client applications. 

I looked at libpq api and found following api to describe a select statement

PQfname()
PQftype()
PQfsize()

However, PQfsize() gives me the space alloced for this column in database
row. How
can I get precision and scale for numeric columns?

I have run into another problem. I execute PREPARE statement with pgexec to
prepare 
the query before executing it multiple time with different parameter values.
It 
seems I can't get the select column information untill I perform an
PQexecPrepared().
Is there any way around it?

Thanks in advance,
Brijesh Shrivastav

Responses

pgsql-interfaces by date

Next:From: Andrew GoldDate: 2004-06-04 16:12:13
Subject: C function linkage and testing
Previous:From: Bruce MomjianDate: 2004-06-02 19:56:28
Subject: Re: Bug in translation of DEALLOCATE PREPARE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group