Re: [PATCH] Add --syntax to postgres for SQL syntax checking

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Add --syntax to postgres for SQL syntax checking
Дата
Msg-id 2980108.1702651820@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Add --syntax to postgres for SQL syntax checking  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: [PATCH] Add --syntax to postgres for SQL syntax checking  (Josef Šimánek <josef.simanek@gmail.com>)
Re: [PATCH] Add --syntax to postgres for SQL syntax checking  (Josef Šimánek <josef.simanek@gmail.com>)
Список pgsql-hackers
Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Fri, 2023-12-15 at 13:21 +0100, Josef Šimánek wrote:
>> Inspired by Simon Riggs' keynote talk at PGCounf.eu 2023 sharing list
>> of ideas for PostgreSQL
>> (https://riggs.business/blog/f/postgresql-todo-2023), I have crafted a
>> quick patch to do SQL syntax validation.
>> 
>> What do you think?

> I like the idea.  But what will happen if the SQL statement references
> tables or other objects, since we have no database?

This seems like a fairly useless wart to me.  What does it do that
you can't do better with existing facilities (psql etc)?

In the big picture a command line switch in the postgres executable
doesn't feel like the right place for this.  There's no good reason
to assume that the server executable will be installed where you want
this capability; not to mention the possibility of version skew
between that executable and whatever installation you're actually
running on.

Another thing I don't like is that this exposes to the user what ought
to be purely an implementation detail, namely the division of labor
between gram.y (raw_parser()) and the rest of the parser.  There are
checks that a user would probably see as "syntax checks" that don't
happen in gram.y, and conversely there are some things we reject there
that seem more like semantic than syntax issues.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [meson] expose buildtype debug/optimization info to pg_config
Следующее
От: Josef Šimánek
Дата:
Сообщение: Re: [PATCH] Add --syntax to postgres for SQL syntax checking