Opened 5 years ago
Last modified 5 years ago
#31463 closed New feature
apply OPTIONS in database settings to dbshell — at Version 6
Reported by: | Dulmandakh | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When I use django.db.backends.postgresql, and set OPTIONS like below, it would apply to psycopg2 connections, but not dbshell. Developers expect that DB connection configuration would apply in all cases.
DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "NAME": "db", "HOST": "127.0.0.1", "OPTIONS": {"options": "-c default_text_search_config=simple"} } }
Entering below command in dbshell would show pg_catalog.english instead of pg_catalog.simple.
SHOW default_text_search_config;
Change History (6)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
#29501 would allow developers to pass SQL to dbshell and execute it. Mine is about dbshell connection configuration, then make it consistent with psycopg2 connection configuration.
comment:3 by , 5 years ago
I'm playing with full text search, and been wondering why same SQL works different in dbshell and test cases. after some digging, I found that dbshell doesn't pass OPTIONS down to sql, please see the PR https://github.com/django/django/pull/12715/
comment:4 by , 5 years ago
Also related to #30865, if we go this way all backends should be adjusted to support such pattern not solely Postgres.
comment:5 by , 5 years ago
Simon Charette, I see. But not all backends are equal even documentation states that OPTIONS will depend on a backend.
comment:6 by , 5 years ago
Description: | modified (diff) |
---|
Hi. Thanks for the report.
We're just about to merge #29501, which will allow passing extra options to dbshell. I know it's not exactly what you've asked for but would it address your use-case do you think?
Thanks.