Equivalent shell script of create user and schema in specific postgres db

From: Abhra Kar <abhra(dot)kar(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Equivalent shell script of create user and schema in specific postgres db
Date: 2018-01-31 16:57:53
Message-ID: CAFNULEeqmQxctPpUknOjdDMY8a+rEexRHauz5_1vsab9sbvZPA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Create a user and schema of same name with in ‘abc’ db through linux shell –

Psql steps---

1> [/home]# su postgres

2> bash-4.1$ psql

3> postgres=# \c abc [ set database abc]

4> abc=# create user abhra with password ‘1234’

5> abc=# alter user abhra with superuser

6> abc=# create schema authorization with abhra;

I need to create a xyz.sh file which will do the same thing and username
and password pass as argument. Like in a configuration file it will be
mentioned and in xyz.sh file will be access as $1 , $2

What should be the equivalent shell script?

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2018-01-31 17:13:40 Re: Equivalent shell script of create user and schema in specific postgres db
Previous Message Alexander Stoddard 2018-01-31 16:52:38 Please help me understand unlogged tables