Re: database "cdf_100_1313" does not exist - Mailing list pgsql-general

From Tom Lane
Subject Re: database "cdf_100_1313" does not exist
Date
Msg-id 28857.1568038643@sss.pgh.pa.us
Whole thread Raw
In response to Re: database "cdf_100_1313" does not exist  (Rob Sargent <robjsargent@gmail.com>)
Responses Re: database "cdf_100_1313" does not exist
List pgsql-general
> 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Permissions on postgresql.conf, psql and patroni
Next
From: nikhil raj
Date:
Subject: Re: database "cdf_100_1313" does not exist