A text field is on one of my models. For search purposes, I’ve made an index on this field:
class my_model(models.Model):
text = models.TextField(null=True)
vector = SearchVectorField(null=True, default='')
I have so far just used the insert command to add data to this table, and I did not supply any data for the column at the time of insertion. Everything was fine, but now this model has a many-to-many field. I want to update the insert function to use Django ORM as I haven’t created an explicit through table. I’m having trouble since I’m getting an error when I try to use ORM to enter the following statement into the model:
a1 = my_model(text='test')
a1.save()
Error:
ProgrammingError: column "vector" can only be updated to DEFAULT
DETAIL: Column "vector" is a generated column.
Also, i tried the following with the same error:
a1 = my_model(text='test', vector = '')
a1.save()
Thanks in advance.