Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requiring hostname for postgresql doesn't work with socket based connections #490

Open
adamgreig opened this issue Sep 20, 2023 · 1 comment

Comments

@adamgreig
Copy link

Bug Report

Describe the bug

I'm using Django with PostgreSQL on the same server, and so it connects using a UNIX socket and IDENT authentication - the only configuration required is the database name, there's no hostname or username. However, create_postgres_uri() requires that host is set:

def create_postgres_uri(self):
host = self.settings.get("HOST")
if not host:
raise DumpError("A host name is required")

The correct URI to generate is just postgresql:///dbname, which would be generated correctly without this check, and works fine with pg_dump. As far as I can tell, it would be enough to just remove this check, and if connection later fails, pg_dump's error can be reported instead. I'm happy to open a PR if that sounds like an acceptable solution.

@stribny
Copy link

stribny commented Jan 26, 2024

I just run into this problem, so +1 and would be great to have this fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants