Ticket #5435: no_need_for_db_user.patch
File no_need_for_db_user.patch, 1.4 KB (added by , 17 years ago) |
---|
-
django/contrib/gis/db/backend/postgis/creation.py
28 28 29 29 # Constructing the necessary SQL to create the database (the DATABASE_USER 30 30 # must possess the privileges to create a database) 31 create_sql = 'CREATE DATABASE %s OWNER %s' % (connection.ops.quote_name(db_name), 32 settings.DATABASE_USER) 31 create_sql = 'CREATE DATABASE %s' % connection.ops.quote_name(db_name) 32 if settings.DATABASE_USER: 33 create_sql += ' OWNER %s' % settings.DATABASE_USER 34 33 35 cursor = connection.cursor() 34 36 _set_autocommit(connection) 35 37 … … 133 135 def get_cmd_options(db_name): 134 136 "Obtains the command-line PostgreSQL connection options for shell commands." 135 137 # The db_name parameter is optional 138 options = '' 136 139 if db_name: 137 options = '-d %s -U %s ' % (db_name, settings.DATABASE_USER)138 else:139 options = '-U %s ' % settings.DATABASE_USER140 options += '-d %s ' % db_name 141 if settings.DATABASE_USER: 142 options += '-U %s ' % settings.DATABASE_USER 140 143 if settings.DATABASE_HOST: 141 144 options += '-h %s ' % settings.DATABASE_HOST 142 145 if settings.DATABASE_PORT: