Re: database "cdf_100_1313" does not exist

Поиск
Список
Период
Сортировка
От nikhil raj
Тема Re: database "cdf_100_1313" does not exist
Дата
Msg-id CAG1ps1wFkVhqxd4u90070KjU8_TGUE-3b9BWZ9oE9z4cShqxJA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: database "cdf_100_1313" does not exist  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: database "cdf_100_1313" does not exist
Re: database "cdf_100_1313" does not exist
Список pgsql-general
Hi All,

just did few modification of the shell command still having the same issue. Having the issue with the Grant command only its not taking the parameters.

 /usr/lib/postgresql/11/bin/psql -p 5432 -U postgres -d $DBLIST -c "GRANT CONNECT ON DATABASE \"$DBLIST\" TO cpupdate"
ERROR:  database " CDF_100_1313" does not exist

** For the above one we have its taking space in the Databases name starting.

/usr/lib/postgresql/11/bin/psql -p 5432 -U postgres -d $DBLIST -c "GRANT CONNECT ON DATABASE "$DBLIST" TO cpupdate"
psql: warning: extra command-line argument "ASD_100_1313 TO cpupdate" ignored
ERROR:  syntax error at end of input
LINE 1: GRANT CONNECT ON DATABASE
                                  ^



On Mon, Sep 9, 2019 at 7:47 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> On Sep 9, 2019, at 7:16 AM, nikhil raj <nikhilraj474@gmail.com> wrote:
>> /usr/lib/postgresql/11/bin/psql -p 5432 -U postgres -d $DBLIST -c "GRANT CONNECT ON DATABASE $DBLIST TO cpupdate"
>> ERROR:  database "cdf_100_1313" does not exist

This still isn't quoted properly.  It's tricky since double-quote is
special to both the shell and SQL.  You need something like

/usr/lib/postgresql/11/bin/psql -p 5432 -U postgres -d "$DBLIST" -c "GRANT CONNECT ON DATABASE \"$DBLIST\" TO cpupdate"

                        regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: database "cdf_100_1313" does not exist
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: database "cdf_100_1313" does not exist