From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Szymon Guz <mabewlun(at)gmail(dot)com> |
Cc: | Peter Kroon <plakroon(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: validate synatax |
Date: | 2013-12-11 13:23:31 |
Message-ID: | CAB7nPqQ4kVaKtVM20Sgj7encFczSJz5CTFeNZM_VFNhsWyGgTg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Dec 11, 2013 at 9:11 PM, Szymon Guz <mabewlun(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jov | 2013-12-11 13:32:46 | Re: validate synatax |
Previous Message | Albe Laurenz | 2013-12-11 13:15:54 | Re: Convert table to view 9.1 |