Re: database "cdf_100_1313" does not exist

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: nikhil raj <nikhilraj474(at)gmail(dot)com>, Dan Livingston <danlivingstone(at)gmail(dot)com>, 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 14:17:23
Message-ID: 28857.1568038643@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Sep 9, 2019, at 7:16 AM, nikhil raj <nikhilraj474(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message nikhil raj 2019-09-09 14:30:16 Re: database "cdf_100_1313" does not exist
Previous Message Tom Lane 2019-09-09 14:03:57 Re: Permissions on postgresql.conf, psql and patroni