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

Postgresql and local socket connection (especially the local port) #23

Closed
Jajcus opened this issue Jun 24, 2024 · 0 comments
Closed

Postgresql and local socket connection (especially the local port) #23

Jajcus opened this issue Jun 24, 2024 · 0 comments

Comments

@Jajcus
Copy link

Jajcus commented Jun 24, 2024

When talking to a local database the most convenient option is to use local socket. No need for opening IP ports or password management, user access is controlled by kernel. Reasonable defaults are used by standard PostgreSQL client implementation, so no URL, hostname, port, username or even database name needs to be provided (when using local connection, default port, current logged-in user name and the database named after the user name):

jajcus@jajco:~$ psql
psql (14.12 (Ubuntu 14.12-0ubuntu0.22.04.1))
Type "help" for help.

jajcus=# 

I would expect the same (or similar) experience by any PotgreSQL client, but this is not the case with sql-studio:

jajcus@jajco:~$ sql-studio postgres 
error: the following required arguments were not provided:
  <URL>

Usage: sql-studio postgres <URL>

For more information, try '--help'.
jajcus@jajco:~$ sql-studio postgres postgresql:///
Error: 
   0: invalid configuration: both host and hostaddr are missing
   1: both host and hostaddr are missing

Location:
   src/main.rs:982

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
jajcus@jajco:~$ sql-studio postgres postgresql:///jajcus
Error: 
   0: invalid configuration: both host and hostaddr are missing
   1: both host and hostaddr are missing

Location:
   src/main.rs:982

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Is it even possible to connect to the database via local socket? What is the expected URL format in this case? E.g. postgresql:///jajcus works for sqlx.

BTW, requiring postgres command before a postgresql: URL is also a weird CLI choice – the URL already implies the database type – that is the very idea of using 'URLs' for database access.

@frectonz frectonz closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
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