DWIM mode for psql

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема DWIM mode for psql
Дата
Msg-id CA+hUKGL-i3KEFNTc5VUSwizSjvop_3LTpHifVyN0o-Bi2J13hA@mail.gmail.com
обсуждение исходный текст
Ответы Re: DWIM mode for psql
Re: DWIM mode for psql
Re: DWIM mode for psql
Список pgsql-hackers
Hello,

Building on the excellent work begun by commit e529cd4ffa60, I would
like to propose a do-what-I-mean mode for psql.  Please find a POC
patch attached.  It works like this:

postgres=# select datnaam from pg_database where ooid = 12917;
ERROR:  column "datnaam" does not exist
LINE 1: select datnaam from pg_database where ooid = 12917;
               ^
HINT:  Perhaps you meant to reference the column "pg_database.datname".
postgres=# YES
 datname
----------
 postgres
(1 row)

As you can see, by "shouting" a new keyword at the computer, it will
take its own hint and run the corrected query.  To avoid having to do
this in two steps, you can also shout the whole query for the same
effect:

postgres=# SELECT DATNAAM FROM PG_DATABASE WHERE OOID = 12917;
 datname
----------
 postgres
(1 row)

The next version will be able to fix permissions problems and override
errors automatically as follows, though that is proving trickier to
get working.  Example:

postgres=# SUDO DROP TABLE PG_DATABASS;
NO CARRIER

-- 
Thomas Munro
https://enterprisedb.com

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: COPY FROM WHEN condition
Следующее
От: Andres Freund
Дата:
Сообщение: Re: DWIM mode for psql