Re: checking select query syntax and semantics via php without executing

Marco Dieckhoff <[email protected]> Tue, 06 Oct 2009 00:03:36 +0200
Newsgroups gmane.comp.db.postgresql.php
Message-ID <[email protected]>
Bill Moran schrieb:
> In response to Marco Dieckhoff <[email protected]>:
>> Hi there!
>>
>> Is it possible in PHP to give a sql (select) query to Postgres via pg_* 
>> so that it is NOT executed but merely checked for syntax including 
>> correct, existing field and table names, and data types?

> Off the top of my head, you could prefix the query with EXPLAIN, which
> will cause it to be planned (thus checking syntax) and return an
> execution plan, but not actually run the query.

Works as a charm, thanks to both of you.

Must be one of the quickest "case solved, thread closed" I have ever seen :)



-- 
Sent via pgsql-php mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php