﻿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
2167	Strings from pre-save trigger not quoted in Postgre	Dagur Páll Ammendrup	Adrian Holovaty	"I have this trigger in my model:

{{{
        def save(self):
            self.body_rest= publish_parts(self.body, writer_name='html4css1')['fragment']
}}}

It uses reST on the 'body' field and puts the output into the body_rest. This works fine with MySQL but if I try this on a server using PostgreSQL I get this error:

{{{
Traceback (most recent call last):
File ""/usr/lib/python2.4/site-packages/django/core/handlers/base.py"" in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File ""/usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py"" in _checklogin
  54. return view_func(request, *args, **kwargs)
File ""/usr/lib/python2.4/site-packages/django/views/decorators/cache.py"" in _wrapped_view_func
  40. response = view_func(request, *args, **kwargs)
File ""/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"" in change_stage
  330. new_object = manipulator.save(new_data)
File ""/usr/lib/python2.4/site-packages/django/db/models/manipulators.py"" in save
  101. new_object.save()
File ""/home/dagur/sytes/blog/models.py"" in save
  51. super(Post, self).save()
File ""/usr/lib/python2.4/site-packages/django/db/models/base.py"" in save
  169. db_values + [pk_val])
File ""/usr/lib/python2.4/site-packages/django/db/backends/util.py"" in execute
  12. return self.cursor.execute(sql, params)

  ProgrammingError at /admin/blog/post/1/
  ERROR: syntax error at or near ""=<"" at character 213 UPDATE ""blog_post"" SET ""slug""='do-i-have-blog-again',""category_id""='general-nonsense',""title""='Do I have a blog again?',""date""='2006-06-14 00:42:00',""image""='',""body""='It looks like it. More later...',""body_rest""=<p>It looks like it. More later...</p> ,""publish""=True WHERE ""id""='1'
}}}

As you can see the text is quoted for the 'body' field but not the 'body_rest' field, causing a syntax error. 
"	defect	closed	Database layer (models, ORM)	dev	normal	invalid			Unreviewed	0	0	0	0	0	0
