Re: Enhancement to psql command, feedback.

Поиск
Список
Период
Сортировка
От Ron
Тема Re: Enhancement to psql command, feedback.
Дата
Msg-id 090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com
обсуждение исходный текст
Ответ на Enhancement to psql command, feedback.  (John McKown <john.archie.mckown@gmail.com>)
Ответы Re: Enhancement to psql command, feedback.  (John McKown <john.archie.mckown@gmail.com>)
Re: Enhancement to psql command, feedback.  (Steven Lembark <lembark@wrkhors.com>)
Список pgsql-general
On 05/09/2018 02:59 AM, John McKown wrote:
I just wanted to throw this out to the users before I made a complete fool of myself by formally requesting it. But I would like what I hope would be a minor change (enhancement) to the psql command. If you look on this page, https://wiki.postgresql.org/wiki/Shared_Database_Hosting ,
you will see a number of example which look like:

psql -U postgres template1 -f - << EOT

REVOKE ALL ON DATABASE template1 FROM public;
REVOKE ALL ON SCHEMA public FROM public;
GRANT ALL ON SCHEMA public TO postgres;
CREATE LANGUAGE plpgsql;

EOT

To me this looks similar to a UNIX shell script.

Because it is a Unix shell script.  The "<< EOT" is part of a heredoc, which is designed to keep everything in one place instead of needing a second file for the SQL commands.

https://en.wikipedia.org/wiki/Here_document

(The concept is as old as computing.  Anyone who's worked on mainframes or proprietary minicomputers from DEC will instantly recognize it.)

--
Angular momentum makes the world go 'round.

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

Предыдущее
От: Matt Zagrabelny
Дата:
Сообщение: Re: Enhancement to psql command, feedback.
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: New install of 9.5.12 missing default PostgreSQL DB