﻿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
34131	Postgres AutoField change from serial to identity	Marco Glauser	nobody	"With django 4.1 the following change was added (#30511):
  On PostgreSQL, AutoField, BigAutoField, and SmallAutoField are now created as identity columns rather than serial columns with sequences.

This causes issues for us because our migrations depend on sequences being created by the BigAutoField. 

We use Luhn's algorithm to generate ids that are harder to mistype by accident. The easiest way for us to do that is to change the default of the id column.

{{{
ALTER TABLE invoice_invoice ALTER COLUMN id SET DEFAULT luhn_generate(nextval('invoice_invoice_id_seq'));
}}}

This no longer works with 4.1 and we get the following error when trying to apply the migration (for example when running tests)

{{{
django.db.utils.ProgrammingError: column ""id"" of relation ""invoice_invoice"" is an identity column
}}}

Already migrated databases continue to work as expected. 
This is currently blocking our upgrade path to 4.1 since we cannot run our unit tests.

"	Bug	closed	Database layer (models, ORM)	4.1	Normal	invalid		Florian Apolloner	Unreviewed	0	0	0	0	0	0
