The current trigger does not work with certain parts of the django ORM.
Specifically if a field is changed after creation and the change does not affect one of the full text indexes columns then the fts field will be set to ''
To reproceudre
call objects.create(..) to create an object
change a non fts column on the object
call .save() again
the UPDATE query from django will now contain <fts_field> = '' since '' was the value when .create() saved the object and django does not check for other updates.
Since non of the fts fields has changed the IF clause will block the recalculation of the FTS index and as a result the fts_field will get set to ''.
This simply ensures that the fts field cannot be changed by django
The current trigger does not work with certain parts of the django ORM. Specifically if a field is changed after creation and the change does not affect one of the full text indexes columns then the fts field will be set to ''
To reproceudre call objects.create(..) to create an object change a non fts column on the object call .save() again
the UPDATE query from django will now contain
<fts_field> = ''
since '' was the value when .create() saved the object and django does not check for other updates.Since non of the fts fields has changed the IF clause will block the recalculation of the FTS index and as a result the fts_field will get set to ''.
This simply ensures that the fts field cannot be changed by django