RE: database "cdf_100_1313" does not exist

2019-09-09 Thread Klint Gore
From: nikhil raj [mailto:nikhilraj...@gmail.com] Sent: Tuesday, 10 September 2019 12:39 AM To: Adrian Klaver Cc: Tom Lane; Rob Sargent; Dan Livingston; Karsten Hilbert; pgsql-general@lists.postgresql.org Subject: Re: database "cdf_100_1313" does not exist > DBLIST=/usr/lib/post

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread nikhil raj
Hi Adrian, 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

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread Daniel Verite
nikhil raj 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 That's because you don't use the unaligned format to get the list of results. You should add -A to

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread Adrian Klaver
On 9/9/19 7:30 AM, nikhil raj wrote: 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

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread nikhil raj
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 "

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread Tom Lane
> On Sep 9, 2019, at 7:16 AM, nikhil raj 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 t

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread Rob Sargent
> On Sep 9, 2019, at 7:16 AM, nikhil raj wrote: > > 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 > Can we see the output

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread nikhil raj
Hi Rob, Please find the out put. Name | Owner | Encoding | Collate |Ctype| Access privileges --+--+--+-+-+--- CDF_10_11 | cpuser | UTF8 | en_US.UTF-8 | en_US.UTF-8 | cpuser=CT

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread Dan Livingston
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/po

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread nikhil raj
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 wrote: > > I think you need to add parens around

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread nikhil raj
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 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 D

Re: database "cdf_100_1313" does not exist

2019-09-09 Thread Karsten Hilbert
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