On Wed, Dec 11, 2013 at 9:11 PM, Szymon Guz <mabewlun@xxxxxxxxx> 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general