From: nikhil raj [mailto:nikhilraj474@xxxxxxxxx]
Sent: Tuesday, 10 September 2019 12:39 AM To: Adrian Klaver Cc: Tom Lane; Rob Sargent; Dan Livingston; Karsten Hilbert; pgsql-general@xxxxxxxxxxxxxxxxxxxx Subject: Re: database "cdf_100_1313" does not exist
> 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"
Øonly in the grant its taking space rest in -d its perfectly all right.
Add –A to the options of the “select datname...” call to psql. The aligned output is adding a space to the front of the value.