sudo -u postgres createdb ABCsu -c "psql -d ABC"if [ $3 == 'xxxxx' ]thensu -c "psql -c \"grant all privileges on database ABC to xxxx\"" postgressu -c "psql -c \"create schema authorization xxxx\"" postgreselsesu -c "psql -c \"grant all privileges on database ABC to yyyy\"" postgressu -c "psql -c \"create schema authorization xxxx\"" postgresfi Hi Melvin, I executed the above script but xxxx schema created with in postgres db not with in ABC db. And in terminal didn't show the message connected to ABC database. What is wrong I am doing here?Regards,AbhraOn Fri, Feb 2, 2018 at 7:48 AM, Melvin Davidson <melvin6925@gmail.com> wrote:On Thu, Feb 1, 2018 at 9:09 PM, Abhra Kar <abhra.kar@gmail.com> wrote: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 ABCABC=# create schema authorization myschema In xyz.sh I executed the following script --- su -c "psql -c \"\c ABC \"" postgressu -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> But schema created with in postgres database not with in ABC database.Just specify the database in the command line:EG: su -c "psql -d ABC"-- Melvin DavidsonI reserve the right to fantasize. Whether or not you wish to share my fantasy is entirely up to you.
sudo -u postgres createdb ABCsu -c "psql -d ABC"
su -c "psql -d ABC"
if [ $3 == 'xxxxx' ]
then
su -c "psql -c \"grant all privileges on database ABC to xxxx\"" postgres
su -c "psql -c \"create schema authorization xxxx\"" postgres
else
su -c "psql -c \"grant all privileges on database ABC to yyyy\"" postgres
fi
Hi Melvin,
On Thu, Feb 1, 2018 at 9:09 PM, Abhra Kar <abhra.kar@gmail.com> wrote: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 ABCABC=# create schema authorization myschema In xyz.sh I executed the following script --- su -c "psql -c \"\c ABC \"" postgressu -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> But schema created with in postgres database not with in ABC database.Just specify the database in the command line:EG: su -c "psql -d ABC"-- Melvin DavidsonI reserve the right to fantasize. Whether or not you wish to share my fantasy is entirely up to you.
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 ABCABC=# create schema authorization myschema In xyz.sh I executed the following script --- su -c "psql -c \"\c ABC \"" postgressu -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
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
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных