206

When I connect to my Heroku - Postgresql database via pgAdmin3, It lists all the tables (about 2600). Every time I open the pgAdmin3 I have to find my own database.

Is there a way to hide databases that I'm not allowed to access ?

Thermech
  • 4,371
  • 2
  • 39
  • 60
alioguzhan
  • 7,657
  • 10
  • 46
  • 67

5 Answers5

451

Had the same issue, as its a shared space on AWS with 1000 other DBs.

pgAdmin 3

  1. Make sure you are disconnected from your server.
  2. Right click your Server -> properties -> Advanced tab.
  3. In 'DB restriction' type in the name of your database(s) enclosed in single quotes and separated by spaces. E.g. 'dback447'

pgAdmin 4

Same as above, but on step 3 do not use quotes, just the plain DB name. E.g dback447

pgAdmin 4 version 6.1

Same as above, but press Tab after entering the name of each database. Commas or spaces take your string as a name of one single database.

And you have to press Tab even if you want to type only one database name, otherwise the Save button ignores your changes.

enter image description here

enter image description here

enter image description here

Honza Zidek
  • 9,204
  • 4
  • 72
  • 118
Matt Stevens
  • 4,546
  • 1
  • 13
  • 8
  • 40
    just want to add that you have to be disconnected from the server first before doing this, otherwise the DB restriction field will be grayed out – Chin May 02 '13 at 18:47
  • 14
    Another thing: use single quotes! – luigi7up Jun 23 '13 at 16:21
  • 2
    @Chin: I updated the answer based on your comment. I hope you don't mind. – Zoltán Sep 29 '13 at 11:23
  • 2
    @luigi7up: I updated the answer based on your comment. I hope you don't mind. – Zoltán Sep 29 '13 at 11:24
  • 5
    how it is done in pgadmin4? There is no advanced tab in pgadmin4. – Roman Aug 25 '16 at 10:31
  • 9
    @Roman AFAIK how this is done in pgadmin4 is by trashing that and using pgadmin3. – n_b Sep 03 '16 at 22:49
  • 1
    Please all requests for this on pgadmin4 redirects to this page. pgAdmin4 has a different config. Is there anyone in the house that can be of help? thanks in advance – cookies Oct 27 '16 at 20:26
  • 14
    In PgAdmin 4, single quotes doesn't work anymore. Just the plain database name. – reinaldoluckman Oct 20 '17 at 21:12
  • For pgAdmin 4-4.2 you need to separate them using either a comma or tab according to the instructions. I tried this with seven databases but only one of them shows up when I connect the server. I'm not sure why. – Pamela Cook - LightBe Corp Feb 17 '19 at 22:12
  • I'm trying to find this answer! Why do I keep getting "DB NOT FOUND" error. Turned out I just need to quote the thing. And sadly I tried to find the solution for hours. Thanks!! – Michael Harley Oct 23 '20 at 10:55
  • In the V6 of pgAdmin I was unable to get this to work using the single quotes. Without the quotes worked as described. – 3030tank Apr 12 '23 at 10:38
17

pgAdmin 4 does not contain the 'DB Restriction' which is the only reason I am not using it, forcing me to settle for pgAdmin 3.

There was a ticket opened up to add this functionality in pgAdmin 4 ... https://redmine.postgresql.org/issues/1918

Garrett
  • 211
  • 2
  • 5
16

The latest version of pgAdmin 4 (2.0) has the DB restriction property too in the "Advanced" tab of the server connection property, much the same as in pgAdmin 3. No quotes needed.

gmorph
  • 596
  • 5
  • 8
7

I had the same issue with only 10 other DBs and Matt Stevens' answer was only partly helpful ie at first it helped and then I got access to another DB on the same server.

I did all as described and it shoed no DB at all. In 'DB restriction' you type in the name of your databases enclosed in single quotes and separated by commas. E.g. 'db1', 'db2'.

Burkhard
  • 14,596
  • 22
  • 87
  • 108
6

Don't enclose in single quotes in pgAdmin 4.5, it will not work if you do.

mishap
  • 8,176
  • 14
  • 61
  • 92