pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: pgsql-interfaces@postgresql.org
Subject: Parse a statement, get parameter types and return types
Date: Mon, 18 Jul 2005 14:03:37 +0100
Message-ID: <20050718130337.GA23201@furbychan.cocan.org> (raw)

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:

http://www.postgresql.org/docs/current/static/libpq-exec.html#AEN23157

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
it.

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com



view thread (3+ messages)  latest in thread

Message-ID: <20050718130337.GA23201@furbychan.cocan.org>
Permalink:  ../20050718130337.GA23201@furbychan.cocan.org/
Also on:    postgresql.org/message-id/20050718130337.GA23201@furbychan.cocan.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: rich@annexia.org
  Subject: Re: Parse a statement, get parameter types and return types
  In-Reply-To: <20050718130337.GA23201@furbychan.cocan.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