Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Changed postgresql DB backend so that it gives a helpful error messag…

…e if people are using psycopg 2 instead of version 1

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 68baafc commit 361be49fe7cd944606c71b772c9407a732848b60 @adrianholovaty adrianholovaty committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/core/db/backends/
5 django/core/db/backends/
@@ -62,7 +62,10 @@ def get_last_insert_id(cursor, table_name, pk_name):
# Register these custom typecasts, because Django expects dates/times to be
# in Python's native (standard-library) datetime/time format, whereas psycopg
# use mx.DateTime by default.
-Database.register_type(Database.new_type((1082,), "DATE", typecasts.typecast_date))
+ Database.register_type(Database.new_type((1082,), "DATE", typecasts.typecast_date))
+except AttributeError:
+ raise Exception, "You appear to be using Psycopg version 2, which isn't supported yet, because it's still in beta. Use psycopg version 1 instead:"
Database.register_type(Database.new_type((1083,1266), "TIME", typecasts.typecast_time))
Database.register_type(Database.new_type((1114,1184), "TIMESTAMP", typecasts.typecast_timestamp))
Database.register_type(Database.new_type((16,), "BOOLEAN", typecasts.typecast_boolean))

0 comments on commit 361be49

Please sign in to comment.
Something went wrong with that request. Please try again.