﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
491	Patch to allow non-user PostgreSQL connections.	jafo@…	Adrian Holovaty	"I'm just using the user the application is running as for the database connection, so I use ""dbname=whatever"" as the psycopg connection string.  The PostgreSQL backend requires ""user="".  The following patch fixes this.

Index: core/db/backends/postgresql.py
===================================================================
--- core/db/backends/postgresql.py      (revision 632)
+++ core/db/backends/postgresql.py      (working copy)
@@ -17,10 +17,12 @@
     def cursor(self):
         from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE
_HOST, DATABASE_PASSWORD, DEBUG, TIME_ZONE
         if self.connection is None:
-            if DATABASE_NAME == '' or DATABASE_USER == '':
+            if DATABASE_NAME == '':
                 from django.core.exceptions import ImproperlyConfigured
-                raise ImproperlyConfigured, ""You need to specify both DATABASE_
NAME and DATABASE_USER in your Django settings file.""
-            conn_string = ""user=%s dbname=%s"" % (DATABASE_USER, DATABASE_NAME)
+                raise ImproperlyConfigured, ""You need to specify the DATABASE_N
AME in your Django settings file.""
+            conn_string = ""dbname=%s"" % DATABASE_NAME
+            if DATABASE_USER:
+                conn_string = ""user=%s %s"" % ( DATABASE_USER, conn_string )
             if DATABASE_PASSWORD:
                 conn_string += "" password=%s"" % DATABASE_PASSWORD
             if DATABASE_HOST:
"	defect	closed	Database layer (models, ORM)		normal	fixed			Unreviewed	0	0	0	0	0	0
