Open
Description
I have an insert query where I would like to have the database generate some field using a sequence. At the moment, Django does not return the generated field from the database by default, so I would like to use insert_and_get
to add an additional (or all) fields to the RETURNING
clause of my insert statement.
I don't need any special on_conflict
behavior, I would just like to return the database generated field and have Django properly update the model field instead of only returning the pk.
It appears that the insert_and_get
method is not exposed by PostgresManager
. Is there any reason I must use on_conflict
to get the entire row returned?
To clarify, I would simply like to execute
INSERT INTO my_table (some_field, another_field) VALUES (something, something_else) RETURNING *;
and have the Django model be updated appropriately.