﻿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
36566	Allow customization of returning_fields in bulk_create	Take Weiland		"On databases that support `INSERT ... RETURNING` (all but MySQL), `bulk_create` will use it to retrieve the values of generated columns of the inserted rows. ""generated columns"" currently being `AutoField` and `GeneratedField`. These are marked using `db_returning = True`.

This is sufficient for standard uses of `bulk_create`. However `bulk_create` supports a parameter named `update_conflicts`. In case `update_conflicts` Django should use `INSERT ... RETURNING` for at least the primary key, regardless of whether it is an `AutoField` or not. This way the objects returned by `bulk_create` will have the correct primary key set, regardless of whether they were inserted or updated.

I would also propose adding another parameter to `bulk_create` (e.g. `returning_fields`) to let users specify additional fields Django should fetch using `INSERT ... RETURNING`. This way users can specify additional fields that they need to be up to date in the returned objects when using `update_conflicts`."	New feature	closed	Database layer (models, ORM)	5.2	Normal	wontfix			Unreviewed	0	0	0	0	0	0
