Re: validate synatax - Mailing list pgsql-general

From Michael Paquier
Subject Re: validate synatax
Date
Msg-id CAB7nPqQ4kVaKtVM20Sgj7encFczSJz5CTFeNZM_VFNhsWyGgTg@mail.gmail.com
Whole thread Raw
In response to Re: validate synatax  (Szymon Guz <mabewlun@gmail.com>)
List pgsql-general
On Wed, Dec 11, 2013 at 9:11 PM, Szymon Guz <mabewlun@gmail.com> wrote:
> This would simply be as complicated as the database itself, and I'm sure
> that if I had to implement such a validator, I would just finish with
> embedding the query in a transaction rolled back at the end, and run it on
> some test database.
Such a *query validator* needs to go through the database parser of
gram.y and in rewriter to check for some restrictions as well (maybe
some stuff in planner but I cannot recall what now), so you need to
minimize the execution time of the query in planner and executor for
DML/SELECT, and bypass utility execution for a DDL and a utility. You
could use the planner hook to generate a dummy plan that will 1) skip
the planner, 2) minimize the query execution and check only if the
query has a valid grammar for DML/SELECT, and the utility hook to skip
all the DDL/utility executions.

Regards,
--
Michael


pgsql-general by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: Convert table to view 9.1
Next
From: Jov
Date:
Subject: Re: validate synatax