pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marco Dieckhoff <dieck@gmx.de>
To: pgsql-php@postgresql.org
Subject: Re: checking select query syntax and semantics via php without executing
Date: Tue, 06 Oct 2009 00:03:36 +0200
Message-ID: <4ACA6D38.4010005@gmx.de> (raw)
In-Reply-To: <20091005180139.25cc9511.wmoran@potentialtech.com>
References: <4ACA6668.2000701@gmx.de>
	<20091005180139.25cc9511.wmoran@potentialtech.com>

Bill Moran schrieb:
> In response to Marco Dieckhoff <dieck@gmx.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 :)





view thread (5+ messages)  latest in thread

Message-ID: <4ACA6D38.4010005@gmx.de>
Permalink:  ../4ACA6D38.4010005@gmx.de/
Also on:    postgresql.org/message-id/4ACA6D38.4010005@gmx.de

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: dieck@gmx.de
  Subject: Re: checking select query syntax and semantics via php without executing
  In-Reply-To: <4ACA6D38.4010005@gmx.de>
  References: <4ACA6668.2000701@gmx.de> <20091005180139.25cc9511.wmoran@potentialtech.com> <4ACA6D38.4010005@gmx.de>

* 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