Create schema with in a specific database from a script file

From: Abhra Kar <abhra(dot)kar(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Create schema with in a specific database from a script file
Date: 2018-02-02 02:09:00
Message-ID: CAFNULEcrj_+ncsxYT6J=N75ijsYd0sO2YB=_6vXjJBBTt9D=OA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have to write script for psql in a xyz.sh file which should create a
schema in a specific data.In psql prompt I achieve it like --

postgres=# \c ABC

ABC=# create schema authorization myschema

In xyz.sh I executed the following script ---

*su -c "psql -c \"\c ABC \"" postgres*

*su -c "psql -c \"create schema authorization myschema\"" postgres*

In the terminal got message “connected to ABC database”. But schema created
with in postgres database not with in ABC database.

What should be the proper script ?

Thanks and Regards,

Abhra

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2018-02-02 02:18:06 Re: Create schema with in a specific database from a script file
Previous Message Geoffrey Hoffman 2018-02-02 00:47:32 Ensure extension exists