Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
database_exists: don't connect to 'postgres' data base for database e…
…xistence check (#372) * database_exists: remove rewriting of database for connection strings starting with 'postgres' the function tested for the database with the name 'postgres' instead of the database specified by the url. This has been introduced here (the if else branch probably made sense in dro and create, but it doesn't here in my opinion) 5d741c1 d7f2905 * fix
- Loading branch information
5d99747
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit is wrong and should be reverted.
The changed function (
database_exists
) intends to check if the url points to an existing databaseThere are two ways to do that:
postgres
and query the tablepg_database
for the database of the uri.Before this commit, the function did 2. But now, it does neither.
Now, it connects to the default database of the user specified in the uri (not to the database in the uri). If that user is
postgres
, it connects to the correct database. If it isn't, it either connects to the wrong database or (if the default database of that user doesn't exist) fails.