zubkov-andrei / pg_profile

Postgres historic workload reports
Other
212 stars 31 forks source link

The deployment problem #44

Open PPJ001 opened 1 year ago

PPJ001 commented 1 year ago

Great project I'm currently running correctly in my own VIRTUAL machine, but there was an error when deploying to the server. Select * from profile.take_sample(); The following error occurs:

could not establish connection SQL statement "SELECT dblink_connect('server_connection', server_connstr)" PL/pgSQL function take_sample(integer, boolean) line 138 at PERFORM PL/pgSQL function take_sample_subset(integer, integer) line 27 at assignment SQL function "take_sample" statement 1 could not translate host name "." to address: Name or service not known

zubkov-andrei commented 1 year ago

It seems, _pgprofile is unable to connect to the database. When you are creating extension it guesses a connection string to your 'local' server. In most cases of local installation, it'll guess correctly, but not always. You should try to correct a server connection string. You can check it using _showservers() function. This connection string should lead to a database, containing pg_stat_statements extension (if you are using it). Also, you can check correction of a connection string trying to open a dblink connection using it like this:

dblink_connect('server_connection','your_connection_string_here')

pg_profile does right this. While you can't establish a connection, pg_profile can't too.

Use _set_serverconnstr() function to set a new connection string for a server