Since django do not support composite primary keys, I'm forced to use plain SQL queries.
I got two databases defined and when I try to use UPDATE or INSERT, it simply do nothing:
cursor = connections['foods'].cursor()
cursor.execute(sql)
I tried transaction.commit()
cursor.db.set_dirty()
transaction.commit_unless_managed()
Nothing helps. Data not saved in database.
I checked if SQL was valid by executing query through postgres shell. It executed successfully.
P.S. I got the following index defined:
"MeasureWeight_pkey" PRIMARY KEY, btree ("foodCode", measure, amount, "weightGm")