pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rob Sargent <robjsargent@gmail.com>
Cc: nikhil raj <nikhilraj474@gmail.com>
Cc: Dan Livingston <danlivingstone@gmail.com>
Cc: Karsten Hilbert <Karsten.Hilbert@gmx.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: database "cdf_100_1313" does not exist
Date: Mon, 09 Sep 2019 10:17:23 -0400
Message-ID: <28857.1568038643@sss.pgh.pa.us> (raw)
In-Reply-To: <45AD213B-B975-4A43-9C02-3C1513CF23F5@gmail.com>
References: <CAG1ps1w3_Ewc7EaPDWWpm1hae1v4DQsgdDyBFPtE=cBQ66k_kA@mail.gmail.com>
	<20190909115454.GC2813@hermes.hilbert.loc>
	<CAG1ps1x=MQDNQkB7xh6jkO7bgbeUf1JeYTKLJvkKhdEqbh4Ytw@mail.gmail.com>
	<CAG9w53r3U8X5R2xLTZ1voQUyNm9SgSJerVkd=QDzYTM0HHa93g@mail.gmail.com>
	<CAG1ps1we0a9F9xg-2vkRXZcyA1FVFqNZ5QD=i9XU1==6SD2YsA@mail.gmail.com>
	<45AD213B-B975-4A43-9C02-3C1513CF23F5@gmail.com>

> 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





view thread (13+ messages)  latest in thread

Message-ID: <28857.1568038643@sss.pgh.pa.us>
Permalink:  ../28857.1568038643@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28857.1568038643@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robjsargent@gmail.com, nikhilraj474@gmail.com, danlivingstone@gmail.com, Karsten.Hilbert@gmx.net
  Subject: Re: database "cdf_100_1313" does not exist
  In-Reply-To: <28857.1568038643@sss.pgh.pa.us>
  References: <CAG1ps1w3_Ewc7EaPDWWpm1hae1v4DQsgdDyBFPtE=cBQ66k_kA@mail.gmail.com> <20190909115454.GC2813@hermes.hilbert.loc> <CAG1ps1x=MQDNQkB7xh6jkO7bgbeUf1JeYTKLJvkKhdEqbh4Ytw@mail.gmail.com> <CAG9w53r3U8X5R2xLTZ1voQUyNm9SgSJerVkd=QDzYTM0HHa93g@mail.gmail.com> <CAG1ps1we0a9F9xg-2vkRXZcyA1FVFqNZ5QD=i9XU1==6SD2YsA@mail.gmail.com> <45AD213B-B975-4A43-9C02-3C1513CF23F5@gmail.com> <28857.1568038643@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox