Re: database "cdf_100_1313" does not exist

From: nikhil raj <nikhilraj474(at)gmail(dot)com>
To: Dan Livingston <danlivingstone(at)gmail(dot)com>
Cc: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: database "cdf_100_1313" does not exist
Date: 2019-09-09 13:16:49
Message-ID: CAG1ps1we0a9F9xg-2vkRXZcyA1FVFqNZ5QD=i9XU1==6SD2YsA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Dan,

Still facing the same issue.

/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

On Mon, Sep 9, 2019 at 6:38 PM Dan Livingston <danlivingstone(at)gmail(dot)com>
wrote:

>
> I think you need to add parens around the command to populate DBLIST and
> remove the quotes in the GRANT command.
>
> In bash this works for me:
>
>
> DBLIST=$(/usr/lib/postgresql/11/bin/psql -p 5432 -U postgres -d postgres
> -q -t -c "SELECT datname from pg_database where datname in ('tempdb')")
> /usr/lib/postgresql/11/bin/psql -p 5432 -U postgres -d $DBLIST -c "GRANT
> CONNECT ON DATABASE $DBLIST TO dbuser1"
>
>
>
>
>
> On Mon, Sep 9, 2019 at 5:58 AM nikhil raj <nikhilraj474(at)gmail(dot)com> wrote:
>
>> Hi Karsten,
>>
>> yup you are right can you help in i tried by removing quotion and also
>> adding extra having same issue.
>>
>> On Mon, Sep 9, 2019 at 5:25 PM Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
>> wrote:
>>
>>> On Mon, Sep 09, 2019 at 05:16:20PM +0530, nikhil raj wrote:
>>>
>>> >
>>> > The DB is already there and getting the error of the DB does not exist
>>> > where I execute it via shell.
>>> > DBLIST=/usr/lib/postgresql/11/bin/psql -p 5432 -U postgres -d postgres
>>> -q
>>> > -t -c "SELECT datname from pg_database where datname in
>>> > ('CDF_100_1313')"/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
>>>
>>> Likely a quoting issue.
>>>
>>> Karsten Hilbert
>>> --
>>> GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
>>>
>>>
>>>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2019-09-09 13:28:29 Re: database "cdf_100_1313" does not exist
Previous Message Dan Livingston 2019-09-09 13:08:35 Re: database "cdf_100_1313" does not exist