Re: validate synatax
От | Michael Paquier |
---|---|
Тема | Re: validate synatax |
Дата | |
Msg-id | CAB7nPqQ4kVaKtVM20Sgj7encFczSJz5CTFeNZM_VFNhsWyGgTg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: validate synatax (Szymon Guz <mabewlun@gmail.com>) |
Список | 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 по дате отправления: