#1051: [patch] Add support for PostgreSQL Schemas
-------------------------------------------------+--------------------------
   Reporter:  Mao Xizeng <[EMAIL PROTECTED]>  |                Owner:  adrian   
             
     Status:  new                                |            Component:  
Database wrapper      
    Version:  SVN                                |           Resolution:        
                
   Keywords:  PostgreSQL Schemas                 |                Stage:  
Design decision needed
  Has_patch:  1                                  |           Needs_docs:  0     
                
Needs_tests:  1                                  |   Needs_better_patch:  1     
                
-------------------------------------------------+--------------------------
Changes (by [EMAIL PROTECTED]):

 * cc: [EMAIL PROTECTED] (added)

Comment:

 Since the other bugs have been marked duplicate of this one, I'll post
 here.
 
 My ideal use of PostgreSQL schemas would be to have each app live in its
 own schema by default, but with the option of specifying a different one
 (i.e., Model._meta.db_schema).
 
 These patches provide the ability to have models in separate schemas, but
 do not change anything else WRT SQL generation. Until either the QuerySet
 refactor or the multi-db branch hits trunk, the only way to allow per-app
 schemas by default in postgres is to change the quote_name functions for
 the 2 pg wrappers (in base.py). You would need to check for a '.' and
 quote appropriately. This really isn't compatible with how the position
 taken where django guarantees that it will quote everything sent to the db
 literally. However, there's really no other way to split out the table
 name from the schema name.
 
 If the decision is made to go with the concept of just adding simple
 schema support (a la DATABASE_SCHEMAS), the setting should be a tuple, and
 the logic in the pg wrappers (base.py) should be:
 {{{
         if settings.DATABASE_SCHEMAS:
             cursor.execute("SET search_path TO %s;" %
 ','.join(settings.DATABASE_SCHEMAS))
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/1051#comment:9>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to