pgsql: Add infrastructure to support server-version-dependent tabcompl

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Add infrastructure to support server-version-dependent tabcompl
Дата
Msg-id E1eswrh-0007qx-HD@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Add infrastructure to support server-version-dependent tab completion.

Up to now we've not worried about whether psql's tab completion queries
would work against prior server versions.  But since we support older
server versions in describe.c, we really ought to do so here as well.
Failing to take care of this not only leads to loss of tab-completion
service when using an older server, but risks aborting a user's open
transaction when we send an incompatible query to the server.

The recent changes in pg_proc.prokind are one reason to take this more
seriously now than before, and the proposed patch for completion after
SELECT needs some such capability as well.

Hence, create some infrastructure to allow selection of one of several
versions of a query depending on server version.  For cases where we
just need to select one of several query strings, introduce VersionedQuery
and COMPLETE_WITH_VERSIONED_QUERY().  Likewise extend the SchemaQuery
infrastructure to allow versioning of those.

I went ahead and fixed the prokind issues, to serve as an illustration
of how to use versioned SchemaQuery.  To have some illustration of
VersionedQuery, change the support for completion of publication and
subscription names so that psql will not send sure-to-fail queries to
pre-v10 servers.  There is much more that should be done to make tab
completion more friendly to older servers, but this commit is mainly
meant to get the infrastructure in place, so I stopped here.

Discussion: https://postgr.es/m/24314.1520190408@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/722408bcd1bde0b007f73b41135382af11b0282d

Modified Files
--------------
src/bin/psql/tab-complete.c | 458 +++++++++++++++++++++++++++++++-------------
1 file changed, 330 insertions(+), 128 deletions(-)


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: pgsql: shm_mq: Fix detach race condition.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Temporarily instrument postgres_fdw test to look forstatistics