Re: How To Install Extension Via Script File?

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: How To Install Extension Via Script File?
Дата
Msg-id ku13ed$ph3$1@ger.gmane.org
обсуждение исходный текст
Ответ на How To Install Extension Via Script File?  (Don Parris <parrisdc@gmail.com>)
Ответы Re: How To Install Extension Via Script File?  (Don Parris <parrisdc@gmail.com>)
Список pgsql-general
Don Parris wrote on 08.08.2013 23:13:
> And to be able to run it from the Bash prompt (as securely as possible).
>
> I thought I could add the commands and run the create script by doing:
> sudo -u postgres psql -U user -W -d mydb --file=/home/user/dev/mydb_create.sql

> I thought that, running my script as the superuser, it would have the privileges necessary
>to install the extension, but I still got a "permission denied" error.

You are not running the script as superuser because you supplied "-U user" and thus the _script_ is executed
as "user". psql is started as "postgres" (the Linux user, not the DB user).

I don't see the reason for using sudo in the first place, -U is enough:

Leave out the sudo, and use:

   psql -U postgres -W -d mydb --file=/home/user/dev/mydb_create.sql

Or if you do want to use sudo, the leave out the -U user parameter:

   sudo -u postgres psql -d mydb --file=/home/user/dev/mydb_create.sql

Thomas


В списке pgsql-general по дате отправления:

Предыдущее
От: Don Parris
Дата:
Сообщение: How To Install Extension Via Script File?
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: How To Install Extension Via Script File?