Ticket #1051: pg_schemas_full_rev4347.diff

File pg_schemas_full_rev4347.diff, 2.7 KB (added by Marc Fargas <telenieko@…>, 9 years ago)

All In One, psycop, psycop2 and documentation (settings.txt)

  • django/db/backends/postgresql/base.py

     
    7777            self.connection.set_isolation_level(1) # make transactions transparent to all cursors
    7878        cursor = self.connection.cursor()
    7979        cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
     80        if settings.DATABASE_SCHEMAS:
     81            cursor.execute("SET search_path TO %s;" % settings.DATABASE_SCHEMAS)
    8082        cursor = UnicodeCursorWrapper(cursor, settings.DEFAULT_CHARSET)
    8183        if settings.DEBUG:
    8284            return util.CursorDebugWrapper(cursor, self)
  • django/db/backends/postgresql_psycopg2/base.py

     
    4646        cursor = self.connection.cursor()
    4747        cursor.tzinfo_factory = None
    4848        cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
     49        if settings.DATABASE_SCHEMAS:
     50            cursor.execute("SET search_path TO %s;" % settings.DATABASE_SCHEMAS)
    4951        if settings.DEBUG:
    5052            return util.CursorDebugWrapper(cursor, self)
    5153        return cursor
  • django/conf/project_template/settings.py

     
    1111
    1212DATABASE_ENGINE = ''           # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
    1313DATABASE_NAME = ''             # Or path to database file if using sqlite3.
     14DATABASE_SCHEMAS = ''          # Only used with postgresq to support multiple schemas
    1415DATABASE_USER = ''             # Not used with sqlite3.
    1516DATABASE_PASSWORD = ''         # Not used with sqlite3.
    1617DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
  • docs/settings.txt

     
    295295
    296296The username to use when connecting to the database. Not used with SQLite.
    297297
     298DATABASE_SCHEMAS
     299----------------
     300
     301Default: ``''`` (Empty string)
     302
     303On databases supporting Schemas, like PostgreSQL, the search_path will be
     304set to the value of this setting which is, by default, ``public``.
     305
     306Please, note that currently the only backend which schema support is PostgreSQL.
     307
    298308DATE_FORMAT
    299309-----------
    300310
Back to Top