-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Deprecate PostgreSQL-specific connection parameters and behavior #5705
Merged
morozov
merged 2 commits into
doctrine:3.5.x
from
morozov:deprecate-pdo-pgsql-default-dbname
Oct 1, 2022
Merged
Deprecate PostgreSQL-specific connection parameters and behavior #5705
morozov
merged 2 commits into
doctrine:3.5.x
from
morozov:deprecate-pdo-pgsql-default-dbname
Oct 1, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
derrabus
previously approved these changes
Sep 30, 2022
greg0ire
reviewed
Sep 30, 2022
src/Driver/PDO/PgSQL/Driver.php
Outdated
'doctrine/dbal', | ||
'https://github.com/doctrine/dbal/pull/5705', | ||
'The "default_dbname" connection parameter is deprecated. Use "dbname" instead.', | ||
__METHOD__, |
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 parameter appears to be unused
greg0ire
reviewed
Sep 30, 2022
src/Driver/PDO/PgSQL/Driver.php
Outdated
'Relying on the DBAL connecting to the "postgres" database by default is deprecated.' | ||
. ' Unless you want to have the server determine the default database for the connection,' | ||
. ' specify the database name explicitly.', | ||
__METHOD__, |
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.
Same here
morozov
force-pushed
the
deprecate-pdo-pgsql-default-dbname
branch
from
September 30, 2022 14:54
aecb585
to
982a91d
Compare
greg0ire
approved these changes
Oct 1, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
default_dbname
parameter was introduced in #2284 as a hack that was supposed to address doctrine/DoctrineBundle#402.My understanding of the hack is that it would force the connection to return the database currently connected to instead of the database specified in the configuration:
dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
Lines 134 to 136 in 253b602
This hack is irrelevant as of #3606. Since 3.0.0, the connection will always return the name of the database currently connected to. Therefore, this parameter is no longer necessary.
The reason to hardcode
postgres
as the default database doesn't seem valid:dbal/src/Driver/PDO/PgSQL/Driver.php
Line 79 in d5da8b4
According to this article,
This could be reproduced with the following script:
In any event, it is not the job of the DBAL to provide such defaults. If the user is not happy with the defaults provided by the driver, they should provide the database name explicitly.