pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

pgAgent Job issue: Couldn't get a connection to the database when local SQL mode specified in another database other than postgres

Open rdczhzq opened this issue 9 months ago • 1 comments

Please note that security bugs or issues should be reported to [email protected].

Describe the bug

pgAgent Job issue: Couldn't get a connection to the database when local SQL mode specified in another database other than postgres To Reproduce

Step to reproduce:

  1. Create a job (local/SQL)
  2. Select another database other than default postgres
  3. Create SQL scripts & scheduler task
  4. Run the job

Expected behavior The jobstep log should show corresponding result, e.g. s.

Error message The jobstep have a information with status:r and error message: Couldn't get a connection to the database

Screenshots image image

Desktop (please complete the following information):

  • OS:Windows Server 2019
  • Version:Windows Server 2019
  • Mode: Server
  • Browser (if running in server mode): [e.g. chrome, safari]
  • Package type: [e.g. RPM, DEB, Python, Container, etc.]

Additional context

When I switch the database back to default postgres, the job runs succesfully without any problem.

rdczhzq avatar May 16 '24 00:05 rdczhzq

@rdczhzq

Find your %AppData%\Roaming\postgresql\pgpass.conf file under the user whose credentials you have provided for the pgAgent installer. For my computer, it's C:\Users\enterprisedb\AppData\Roaming\postgresql\pgpass.conf

Change the line localhost:5444:edb:enterprisedb:edb to localhost:5444:*:enterprisedb:edb (Format: HOST:PORT:DATABASE:USER:PASSWORD)

Solution

akshay-joshi avatar May 16 '24 13:05 akshay-joshi

Hi Akshay

It works after replace with *.

Will you include this into the end of May release?

Best regards, Joe

@.***

From: Akshay Joshi Date: 2024-05-16 21:17 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job issue: Couldn't get a connection to the database when local SQL mode specified in another database other than postgres (Issue #7478) @rdczhzq Find your %AppData%\Roaming\postgresql\pgpass.conf file under the user whose credentials you have provided for the pgAgent installer. For my computer, it's C:\Users\enterprisedb\AppData\Roaming\postgresql\pgpass.conf Change the line localhost:5444:edb:enterprisedb:edb to localhost:5444::enterprisedb:edb (Format: HOST:PORT:DATABASE:USER:PASSWORD) Solution.png (view on web) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.**>

rdczhzq avatar May 17 '24 01:05 rdczhzq

@rdczhzq

This is not an issue with pgAgent; it is related to PostgreSQL's behavior in providing the correct entry in the pgpass.conf file

Hence closing this issue.

akshay-joshi avatar May 17 '24 05:05 akshay-joshi

Will you transfer the ticket to PostgreSQL or shall I open one on PostSQL ? how to proceed?

Best regards Joe

@.***

From: Akshay Joshi Date: 2024-05-17 13:58 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job issue: Couldn't get a connection to the database when local SQL mode specified in another database other than postgres (Issue #7478) @rdczhzq This is not an issue with pgAgent; it is related to PostgreSQL's behavior in providing the correct entry in the pgpass.conf file Hence closing this issue. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 06:05 rdczhzq

This is not a bug in PostgreSQL either. Check

akshay-joshi avatar May 17 '24 06:05 akshay-joshi

So who should be blamed in this case? Who is responsible for populating this file correctly during installation?

Best regards, Joe

@.***

From: Akshay Joshi Date: 2024-05-17 14:11 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job issue: Couldn't get a connection to the database when local SQL mode specified in another database other than postgres (Issue #7478) This is not a bug in PostgreSQL either. Check — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 06:05 rdczhzq

@rdczhzq

Why you would like to blame anyone? This is a process defined by PostgreSQL. The pgpass.conf file should be modified by the administrator who has installed the database server or owns that machine.

It is similar to "pg_hba.conf" where it's the user's responsibility to change as per his/her requirement.

akshay-joshi avatar May 17 '24 06:05 akshay-joshi

Hi Akshay

In our culture, blame=be responsible for . Now I got it. The DBA for postgres should be responsible for populating this data correct.

Best regards, Joe

@.***

From: Akshay Joshi Date: 2024-05-17 14:34 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job issue: Couldn't get a connection to the database when local SQL mode specified in another database other than postgres (Issue #7478) @rdczhzq Why you would like to blame anyone? This is a process defined by PostgreSQL. The pgpass.conf file should be modified by the administrator who has installed the database server or owns that machine. It is similar to "pg_hba.conf" where it's the user's responsibility to change as per his/her requirement. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 06:05 rdczhzq