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

Creating a new user sometimes creates database does not exist error when reconnecting #1132

Open
tbantle22 opened this issue Jan 16, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@tbantle22
Copy link
Contributor

Starting with a fresh doltgres server:

taylor@MacBook-Pro-3 dgs5 % doltgres --data-dir=.
INFO[0000] Server ready. Accepting connections.
WARN[0000] secure_file_priv is set to "", which is insecure.
WARN[0000] Any user with GRANT FILE privileges will be able to read any file which the sql-server process can read.
WARN[0000] Please consider restarting the server with secure_file_priv set to a safe (or non-existent) directory.

This is kinda hard to repro, but seems potentially related to specifying a host when connecting with the psql client

If I connect to the server using psql and don't specify a host, creating a new user works as expected

taylor@MacBook-Pro-3 ~ % psql -U postgres
Password for user postgres:
psql (15.10 (Homebrew), server 15.0)
Type "help" for help.

postgres=> create user test with password 'pass';
CREATE ROLE
postgres=> exit;

taylor@MacBook-Pro-3 ~ % psql -U postgres
Password for user postgres:
psql (15.10 (Homebrew), server 15.0)
Type "help" for help.

When specifying a host and then creating a user, I get a database not found error when I try to connect as that user. I have also witnessed this when creating a new user and then trying to connect as the default user postgres, but I could not repro for some reason

taylor@MacBook-Pro-3 ~ % psql -U postgres -h localhost
Password for user postgres:
psql (15.10 (Homebrew), server 15.0)
Type "help" for help.

postgres=> create table t (id int primary key);
CREATE TABLE
postgres=> create user test2 with superuser password 'pass';
CREATE ROLE
postgres=> exit;

taylor@MacBook-Pro-3 ~ % psql -U test2 -h localhost
Password for user test2:
psql: error: connection to server at "localhost" (::1), port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL:  "database "test2" does not exist"
@tbantle22 tbantle22 added the bug Something isn't working label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants