X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9ABBF52B41 for ; Mon, 18 Jul 2005 09:54:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93629-03 for ; Mon, 18 Jul 2005 12:54:36 +0000 (GMT) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by svr1.postgresql.org (Postfix) with ESMTP id 62C8D52AD0 for ; Mon, 18 Jul 2005 09:54:31 -0300 (ADT) Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1DuVHV-0006X5-00 for ; Mon, 18 Jul 2005 14:03:37 +0100 Date: Mon, 18 Jul 2005 14:03:37 +0100 To: pgsql-interfaces@postgresql.org Subject: Parse a statement, get parameter types and return types Message-ID: <20050718130337.GA23201@furbychan.cocan.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i From: Richard Jones X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200507/27 X-Sequence-Number: 5663 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