-
Notifications
You must be signed in to change notification settings - Fork 372
fix(pglite-socket): Unix socket CLI docs incorrect — psql cannot connect #943
Copy link
Copy link
Closed
Description
Problem
The CLI usage docs show this for Unix socket connection:
# Start server on a Unix socket
pglite-server --path=/tmp/pglite.sock --run "npm run dev" --include-database-url
# Unix socket connection (if using --path)
PGSSLMODE=disable psql -h /tmp -d template1This does not work because psql -h expects a directory, not a socket file. libpq always appends .s.PGSQL.<port> to the directory path, so it looks for /tmp/.s.PGSQL.5432 which doesn't exist.
What happens
$ pglite-server --path=/tmp/pglite.sock
$ PGSSLMODE=disable psql -h /tmp -d template1
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
The actual socket file is /tmp/pglite.sock, but psql looks for /tmp/.s.PGSQL.5432.
Workaround
Symlink the socket file to the name psql expects:
pglite-server --path=/tmp/pglite.sock
mkdir -p /tmp/pglite-dir
ln -sf /tmp/pglite.sock /tmp/pglite-dir/.s.PGSQL.5432
PGSSLMODE=disable psql -h /tmp/pglite-dir -p 5432 -U postgres -d template1Suggested fix
Either:
- Accept a directory path for
--pathand create the socket as<dir>/.s.PGSQL.<port>(matching Postgres convention), or - Update the docs to note that psql cannot connect directly and show the symlink workaround
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels