Revoke - database does not exist

Started by Prashanth Kumaralmost 12 years ago3 messagesgeneral
Jump to latest
#1Prashanth Kumar
prashanthk@hotmail.com

Hi,

Do not seem to figure out what is wrong here. Why am I getting database does not exist. I just created the database and am able to connect to it as "postgres" user.
I am trying to restrict "testuser" from connecting to "myDB" database.

Thanks in advance.

postgres@ulinux3:~$ createuser -D -S -R -P testuser
Enter password for new role:
Enter it again:
postgres@ulinux3:~$ createdb myDB
postgres@ulinux3:~$ psql
psql (9.3.4)
Type "help" for help.

postgres=# REVOKE ALL PRIVILEGES ON DATABASE myDB FROM testuser;
ERROR: database "mydb" does not exist
postgres=# \q
postgres@ulinux3:~$ psql myDB
psql (9.3.4)
Type "help" for help.

myDB=# REVOKE ALL PRIVILEGES ON DATABASE myDB FROM testuser;
ERROR: database "mydb" does not exist

--Prashanth Kumar

#2Tomas Vondra
tomas.vondra@2ndquadrant.com
In reply to: Prashanth Kumar (#1)
Re: Revoke - database does not exist

<p dir="ltr">I guess you need to quote the identifier, as you use mixed case. I.e. try "myDB" with the double quotes.</p>
<p dir="ltr">Tomas</p>
<div class="quote">Dne 2. 5. 2014 2:49 Prashanth Kumar &lt;prashanthk@hotmail.com&gt; napsal(a):<br type='attribution'><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<br><br>Do not seem to figure out what is wrong here. Why am I getting database does not exist.&nbsp; I just created the database and am able to connect to it as "postgres" user.<br>&nbsp;I am trying to restrict&nbsp; "testuser" from connecting to "myDB" database. <br><br>Thanks in advance.<br><br><br>postgres@ulinux3:~$ createuser -D -S -R -P testuser<br>Enter password for new role:<br>Enter it again:<br>postgres@ulinux3:~$ createdb myDB<br>postgres@ulinux3:~$ psql<br>psql (9.3.4)<br>Type "help" for help.<br><br>postgres=# REVOKE ALL PRIVILEGES&nbsp; ON DATABASE myDB FROM testuser;<br>ERROR:&nbsp; database "mydb" does not exist<br>postgres=# \q<br>postgres@ulinux3:~$ psql myDB<br>psql (9.3.4)<br>Type "help" for help.<br><br>myDB=# REVOKE ALL PRIVILEGES&nbsp; ON DATABASE myDB FROM testuser;<br>ERROR:&nbsp; database "mydb" does not exist<br><br><br><br>--Prashanth Kumar<br><br> </div></body>
</html></blockquote></div>

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Prashanth Kumar (#1)
Re: Revoke - database does not exist

Prashanth Kumar wrote

Hi,

Do not seem to figure out what is wrong here. Why am I getting database
does not exist. I just created the database and am able to connect to it
as "postgres" user.
I am trying to restrict "testuser" from connecting to "myDB" database.

Thomas is likely correct about the quoting. The command programs are
case-sensitive and perform the proper quoting for you when issuing commands;
but when you are inside psql you need to take care to perform the proper
quoting yourself.

WRT grant/revoke keep in mind when you revoke you only remove pre-existing
grants; it does not establish an explicit block on its own. i.e., it
doesn't stop default permissions, or those inherited from PUBLIC, from
applying. You would need to remove those inheritance-granted permissions
and then explicitly grant them back to those who still require them while
omitting those that do not.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Revoke-database-does-not-exist-tp5802183p5802185.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general