Hi, I'm developing my first Django app (a photoalbum-app) and ran into a problem with the database.
Besides the unicode-problem mentioned in another post, I have a problem where it seems 1 directory-name, 'NEW', seems to confuse the system. It might be a problem with PsycoPG... perhaps with Django... I don't know. The error which I get is: Exception Type: ProgrammingError Exception Value: ERROR: NEW used in query that is not in a rule INSERT INTO "photoalbum_dirs" ("name","parent_id","full_path","description","visited_in_browser") VALUES (NEW,9,DownloadedTrainPhotos/NEW,'',False) Exception Location: c:\Python24\lib\site-packages\django\core\db\base.py in execute, line 9 I get this error only on this 1 directory, which is named 'NEW'. As you can see, there are 2 unquoted parameters in the SQL statement. I have no idea why it would not be quoted because all other parameters are quoted; and this should be quoted in all other circumstances because I would have expected tons of errors otherwise. Is it the fact that my string happens to contain a SQL keyword that the db driver decided not to quote this thing? If so, anything that can be done about it? The more I think about it, while writing this msg, the more I think that actually I should hunt down psycopg mailing lists rather than post here... But hopefully someone here still has a good tip. BTW: Related question: Is there any work to support psycopg2 instead of / alongside psycopg1? Would a patch for that be a lot of work? Perhaps this erorr would go away when upgrading to psycopg2. The traceback, as far as I managed to reproduce it without too much trouble: c:\Python24\lib\site-packages\django\core\handlers\base.py in get_response 73 response = callback(request, *callback_args, **callback_kwargs) c:\Documents and Settings\leeuwt\My Documents\Python\DjangoProjects\PhotoAlbum\..\PhotoAlbum\apps\photoalbum\views.py in dir_view 25 dirutils.sync_dir_with_fs(d) c:\Documents and Settings\leeuwt\My Documents\Python\DjangoProjects\PhotoAlbum\..\PhotoAlbum\apps\photoalbum\dirutils.py in sync_dir_with_fs 67 new_dirs = _sync(sub_dirs, d.get_dir_list(), d, dirs.Dir) c:\Documents and Settings\leeuwt\My Documents\Python\DjangoProjects\PhotoAlbum\..\PhotoAlbum\apps\photoalbum\dirutils.py in _sync 52 item.save() c:\Python24\lib\site-packages\django\utils\functional.py in _curried 2 return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items())) c:\Python24\lib\site-packages\django\core\meta\__init__.py in method_save 1025 ','.join(placeholders)), db_values) c:\Python24\lib\site-packages\django\core\db\base.py in execute 9 result = self.cursor.execute(sql, params) Django version: trunk as of revision 2145. Database: PostgreSQL 8.1.2 for Windows PsycoPG: win-psycopg24-pg8.0.zip (don't know more version details, sorry!) Python: 2.4.2 OS: WinXP, SP2 Cheers, --Tim