Skip to content

Commit

Permalink
fix(postgres): by default use domain socket
Browse files Browse the repository at this point in the history
postgres:///dbname tries to connect via localhost, which may not be
allowed.  With localhost as the default parameter, there is no way to
force it to use the local unix domain socket.  This would make the
default using the domain socket, and then connecting via localhost
can be used via "postgres://localhost/dbname".
  • Loading branch information
saulpw authored and cpcloud committed Aug 2, 2023
1 parent f72b46e commit e44fdfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ibis/backends/postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Backend(BaseAlchemyBackend, AlchemyCanCreateSchema):

def do_connect(
self,
host: str = 'localhost',
host: str | None = None,
user: str | None = None,
password: str | None = None,
port: int = 5432,
Expand Down
5 changes: 5 additions & 0 deletions ibis/backends/postgres/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,8 @@ def test_insert_with_cte(con):
expr = X.join(X.mutate(a=X["id"] + 1), ["id"])
Y = con.create_table("Y", expr, temp=True)
assert Y.execute().empty


def test_connect_url_with_empty_host():
con = ibis.connect("postgres:///ibis_testing")
assert con.con.url.host is None

0 comments on commit e44fdfb

Please sign in to comment.