Skip to content

Connection defaults inconsistent with psql #141

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

Closed
lightmare opened this issue Jan 12, 2021 · 1 comment
Closed

Connection defaults inconsistent with psql #141

lightmare opened this issue Jan 12, 2021 · 1 comment

Comments

@lightmare
Copy link

Minor issue that caused me some head scratches.

There's this example with an inaccurate comment in readme:

const sql = postgres({ ...options }) // will default to the same as psql

In psql, if you omit database name, it defaults to user name. So psql -U dummy connects to database dummy, and PGUSER=funny psql connects to database funny.

pg (node-postgres) mimics this behaviour

With this module, if you don't set PGDATABASE in env or the corresponding option, it always connects to database postgres, ignoring PGUSER var.

@porsager
Copy link
Owner

Hey, good catch, thank you. I'll get that fixed for v2.

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