pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Enhancement to psql command, feedback.
Date: Wed, 9 May 2018 08:17:48 -0500
Message-ID: <090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com> (raw)
In-Reply-To: <CAAJSdji027Pjd2QN-t5HP=sB_YgHP=X-SGbUaXy8A+mUPg_buw@mail.gmail.com>
References: <CAAJSdji027Pjd2QN-t5HP=sB_YgHP=X-SGbUaXy8A+mUPg_buw@mail.gmail.com>

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.

view thread (17+ messages)  latest in thread

Message-ID: <090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com>
Permalink:  ../090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com/
Also on:    postgresql.org/message-id/090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Enhancement to psql command, feedback.
  In-Reply-To: <090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com>
  References: <CAAJSdji027Pjd2QN-t5HP=sB_YgHP=X-SGbUaXy8A+mUPg_buw@mail.gmail.com> <090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox