Skip to content

postgresql unix socket #412

@ctxnop

Description

@ctxnop

I'm trying to use unix socket with postgresql without any success. The libpq documentation says that if I provide an host starting with a / unix sockets are used.

My unix socket file for postgresql is /var/run/postgresql/.s.PGSQL.5432, so here is my database.yml

development:
  dialect: postgres
  database: mydatabase
  user: myuser
  password: none
  host: '/var/run/postgresql/.s.PGSQL.5432'

But here is the result:

$ buffalo db drop
v4.11.2

[POP] 2019/07/17 12:11:36 info - drop mydatabase (postgres://myuser:none@/var/run/postgresql/.s.PGSQL:5432/mydatabase?sslmode=disable)
couldn't drop database mydatabase: error dropping PostgreSQL database mydatabase: pq: no pg_hba.conf entry for host "::1", user "myuser", database "var/run/postgresql/.s.PGSQL.5432:5432/postgres", SSL off

As you can see, it tries to use IPv6 connection instead of the unix socket connection. Also the detected database name is garbage.

I tried some path for host omitting the port (.s.PGSQL), the complete filename (keeping only the directory) and even prefixing with "unix:/" (which end up with a lookup failure for the domain 'unix', which is understandable).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workings: triageSome tests need to be run to confirm the issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions