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

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

From: Marco Dieckhoff <dieck(at)gmx(dot)de>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: checking select query syntax and semantics via php without executing
Date: 2009-10-05 22:03:36
Message-ID: 4ACA6D38.4010005@gmx.de (view raw or flat)
Thread:
Lists: pgsql-php
Bill Moran schrieb:
> In response to Marco Dieckhoff <dieck(at)gmx(dot)de>:
>> 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 :)



In response to

Responses

pgsql-php by date

Next:From: Christophe PettusDate: 2009-10-05 22:06:45
Subject: Re: checking select query syntax and semantics via php without executing
Previous:From: Bill MoranDate: 2009-10-05 22:01:39
Subject: Re: checking select query syntax and semantics via php without executing

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