Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGOyk-00051s-2y for pgsql-general@arkaria.postgresql.org; Wed, 09 May 2018 13:17:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGOyi-0003j4-GW for pgsql-general@arkaria.postgresql.org; Wed, 09 May 2018 13:17:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGOyi-0003iv-37 for pgsql-general@lists.postgresql.org; Wed, 09 May 2018 13:17:56 +0000 Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fGOye-0003ES-HX for pgsql-general@lists.postgresql.org; Wed, 09 May 2018 13:17:54 +0000 Received: by mail-it0-x241.google.com with SMTP id z6-v6so20293547iti.4 for ; Wed, 09 May 2018 06:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=bYpvusaXWfdNOGkMLw03Rc/XDwxHtXrq//qJL11+kOs=; b=YHtgz0N7TOz4dgz2MbVUNWhqahBbLepcxRAu4pKk4faNsQxGIM2O7rnqqkb/XVI/Nc WosLYNPVdFG7rI547Hd2iHikaY/HXsYGkgiVkl/D/K6kaeKWz8pf1JsxS50pyUZpxGfw XC8HW0AbCQvRRoisBzsbz/Vf+FWbn37PBCMtL2+qpOjq0LfpQxYcDZ0ma7ltYYuchm2u XV2QG8xgZcfOU+1UsSPveaMbtdot+ik7uhyRCpDUeY31apkuSCLmQ4MFnsbZm/aNTsj5 pFVhT9dbq8wJdglDCznGs97L/aJqi8lX3PJijq/dcBWVfXajAJhlHY21vhJEJhpkfwUQ D4mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=bYpvusaXWfdNOGkMLw03Rc/XDwxHtXrq//qJL11+kOs=; b=kemVAV/64grOM2jF3Boh/lGmtrfrmu/PiJ0aIeQz6HtUU+K3bUNkKPuF7mruX84VwO 4f6N8R4XqqqJh30jIz+l8j3dicQJ+nso90Dit9fXO3pdR1BdlvREqXQUfqOQd9hK0Oyk l8Yn6DIHiAxDtEF4CXcXReixp8ffGm4m0gfh+zpQqVqbnfHvGzgU2mSMNGrplukZg477 /5txyZC8hnp3BjAtXq6SCfdVaRAsbpV29hfdDlbtAicReQauLIet8qrbfSTiOL9WTqUH Grfh2rMLZN//XmpxfPxKSBu5FDzEdgIpYJX5/29R5lWHq90FpjUTnHrZE9ByPAinzYHE qY1w== X-Gm-Message-State: ALQs6tAnI3RqqwJlFazA/0R6a5BqHtWdTbucCVtw4L1ZpWgRWogllB4j yVcbmk7SJkIDrRKqu2hB8DjsbA== X-Google-Smtp-Source: AB8JxZoJtDlQHtY3+x+DTioxHX4c9oZhQ6R54NNBgQDSdPCU7fcDz5bxGLY0CzTKWFTUHG8LHcMKPg== X-Received: by 2002:a24:d309:: with SMTP id n9-v6mr9294446itg.29.1525871871061; Wed, 09 May 2018 06:17:51 -0700 (PDT) Received: from [10.65.10.6] (ip-117-230-239-173.toronto.ca.northamericancoax.com. [173.239.230.117]) by smtp.googlemail.com with ESMTPSA id e15-v6sm13012727ioc.54.2018.05.09.06.17.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 06:17:50 -0700 (PDT) Subject: Re: Enhancement to psql command, feedback. To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <090b3dc0-b817-0368-c437-ef85d20cb67d@gmail.com> Date: Wed, 9 May 2018 08:17:48 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------85BB4E93E5B80C58FD4EACCA" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------85BB4E93E5B80C58FD4EACCA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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. --------------85BB4E93E5B80C58FD4EACCA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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.
--------------85BB4E93E5B80C58FD4EACCA--