#23318: Management command dbshell does not use DATABASE[...]['OPTIONS'] to set 
env
PGOPTIONS
----------------------------------------------+----------------------
     Reporter:  benjaoming                    |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.7-rc-2
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+----------------------
 I am trying to make use of a different "search_path" by use of
 {{{settings.DATABASE[...]['OPTIONS'] = '-c
 search_path=my_other_schema,public'}}} -- however, since they are not
 passed, {{{python manage.py dbshell
 --database=MY_OTHER_DATABASE_CONNECTION}}} will yield an unexpected
 result.

 The problem is that the shell env variable PGOPTIONS="-c
 search_path=MY_SEARCH_PATH_CONF" is not set.

 I am using it for the purpose of having multiple south_migrationhistory
 tables, one for every database connection. They should have been populated
 by:

 {{{
 python manage.py sqlall south | python manage.py dbshell --database=DBNAME
 }}}

 Current work-around:

 {{{
 python manage.py sqlall south | PGOPTIONS="-c
 search_path=NAME_OF_MY_SCHEMA" python manage.py dbshell --database=DBNAME
 }}}

 I am not sure how 1.7 will handle migration histories when populating
 different database connections and auto-selecting them using routers. But
 at least having the above to work would be nice, because it makes it easy
 to manually pipe around the SQL statements to different DB connections.

 Also in more severe cases, not having the connection options passed to
 dbshell might yield other unexpected results!?

 This might be of interest to other db backends, but please limit the issue
 here to only postgres, as it's perfectly simple to copy in the contents of
 OPTIONS to the env variable PGOPTIONS.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23318>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.15f7bbbc275b97c75ecbe23920d8a367%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to