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

Parse a statement, get parameter types and return types

From: Richard Jones <rich(at)annexia(dot)org>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Parse a statement, get parameter types and return types
Date: 2005-07-18 13:03:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Given a statement, eg:

  select foo from bar where col = $1

I'd really like to get the types deduced by the PostgreSQL parser for
the input variables ($1, etc.) and the result column(s).  eg. it might
be $1 :: int4 and foo :: text, or whatever.

It seems from reading about PQprepare that getting the input types
isn't yet possible, but might be in future:

I have no idea where to start getting the result types.

Is this possible in some way?  Is the data perhaps hidden in one of
the pg_* system tables?

Note that I don't want to actually execute the statement, just parse


Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology -
Team Notepad - intranets and extranets for business -


pgsql-interfaces by date

Next:From: Zahid KhanDate: 2005-07-18 13:13:52
Subject: info required about Dot net DataProvider
Previous:From: Michael MeskesDate: 2005-07-16 21:54:09
Subject: Re: ecpg and VARCHAR

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