pgAdmin4: How Can I Get All of my Heroku Postgres Databases to Display in pgAdmin? - postgresql

I have several Heroku Postgres databases that I want to access using pgAdmin4. I'm using version 4.2. I used this link to learn how to hide the databases I don't have access to. I have all the databases entered in DB restriction. However when I connect to the Heroku database, only the maintenance account appears in the list of databases. I updated the password file in advanced properties with my .pgpass file. It still only lists the maintenance database.
I've searched here, the Database Administrators Stack Exchange, and the pgAdmin instructions but have not found anything.

Related

PGAdmin shows excessive amount of database from Heroku

I'm learning some backend stuff, I made a test database locally and filled some data, and then I dump the database to an SQL file with the following command:
pg_dump -U USERNAME DATABASE —no-owner —no-acl -f backup.sql
And finally restore it to Heroku:
heroku pg:psql —app APPNAME < backup.sql
There is only 1 database I’m deploying, however, when I use PGAdmin to connect to it, it shows more than 2000 databases and crashes my computer:
Where are all these databases coming from?
You don't get a dedicated PostgreSQL server with Heroku Postgres. Your databases are co-located with other users' databases on the same server. You'll be able to see the names of other users' databases, but you won't be able to access them.
I'm not sure what "crashes my computer" means, but make sure you are selecting your database when trying to connect.

Postgres add user impossible

I get from customer Postgres 8.4, a very strange edition
I login with Postgres user under trust settings.
But in pgAdmin i got a lot of relations errors
I thought normally tables should goes to DB Catalogs Tables, but here DB Catalogs Tables not exists or i cant see them, all tables i see in db Schemas, and database is working as i can access it through ODBC and Postgres connector, but then i see all 2809 tables i a row without separation. It like multi tenat services, but misconfigured or not suit with pgAdmin.
From pgAdmin i cant create any user and roles, from ssh psql created user cant connect through odbc or Postgres connector, and do not appears in pgAdmin Login/Group Roles tab.
So why i cant access in pgAdmin4 Login/Group Roles tab?
Why cant create user from pgAdmin4?
Why cant access pg_catalogs from pgAdmin4?
Why user created from ssh psql cant access database from ODBC or Postgres connector? (got always table is empty)
If this is multi tenant services why it not work like expected from pgAdmin?
PgAdmin 4 version 5.6
PgAdmin4 says it supports 9.5 and newer. 8.4 is not newer than 9.5.

Best Practice of running postgres in Ubuntu?

I just installed postgresql in Ubuntu 18.04 and been going through the official guide. Things I understand:
The installation comes with the default postgres user
We should not create databases with this default user
Instead we should create a different user
The questions I have are:
Why is this so?
Should the new user name I create be same as my ubuntu user $(whoami) ? Or should it be different ?
Should this new user be a superuser ?
When I have to delete or create databases/tables, do I have to log in to this newly created user or the default postgres user?
You should read the documentation, this is no substitute.
It is ok to use the user postgres to create databases.
Ideally there should be no remote connections with user postgres (block it in pg_hba.conf).
Never let an application connect as superuser.
You should create other database users that are not superusers to create objects and work with them.
The name of the database users has no connection to the name of your operating system users.
For maximum safety, create objects with one user and let your application connect with a different user that has the required permissions on the objects.

Postgres accepts any password

I have the following code which connects to a database on my remote server (the connection script resides on the same server):
Database::$ErrorHandle = new PDO('pgsql:host=111.222.33.44;dbname=mydatabase;', 'postgres', 'mypassword', $db_settings);
The problem is I can change the password to be anything at all and the connection is still made! Like seriously what the hell!?!
Can my database be connected to (providing you know the IP and db name) by anyone from a PHP script running on a different server?
How can I enforce passwords, I have looked at the following stack overflow page and did what they said but still no luck:
How to change PostgreSQL user password?
I am running Ubuntu 12.04 server with PHP 5.5 and Apache2
Off course your postgresql database can be properly configured to only connect with authenticated users even certain users (Roles in Postgres) from certain IPs/sockets.
Some considerations:
Do you see data? Or can you just connect to the server? Can you list the databases?
Look at your pg_hba.conf and setup the proper permissions, per role per database per source
Did you grant access to the mydatabase to everyone? Which roles did you grant access?
Does the database have its tables in the public scheme? And granted access to the public?
Yes, with this configuration everyone who knows your IP and database name can connect to your database.

Insert records to Heroku Postgres database using a rails script

I need to update a dababase from an other database... For this I need to search in existing database if the records exists, if not add... One of the database is locally stored in my computer, and the other one is on heroku... But I don't know how to access heroku database from my computer to create the inserts and to query if I have to insert or not...
Any idea how can I do something like this?
You can connect via any DB tool, e.g. Oracle SQL Developer with Postgres JDBC connector, to a Heroku Postgres DB. The parameters are listed in the GUI of postgres.heroku.com for your instance.