﻿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
30511	AutoField with postgres10/11 as generated identity	Michael Kany	nobody	"We are currently working on a Django / Postgresql 11 project. We needed an adjustment for the postgres module because of its compatibility with .NET Framework and dataset generation.
In postgres 10/11 there is the new feature identity column called GENERATED AS IDENTITY instead of serial.
column_name type GENERATED {ALWAYS | BY DEFAULT} AS IDENTITY [(sequence_option)]
We have created a module based on db.backends.postgres that adds 2 new django model fields. I would like implement the new feature into pyodbc module or new module for postgres 10/11 useful for later versions of django.

Adjustments only in base.py (line 70ff):
data_types = {
        'IdentityAutoField': 'integer',
        'IdentityBigAutoField': 'bigint',

and schema.py, def column_sql () (line 178ff):
# Primary key / unique outputs
        if field.primary_key:
            sql + = ""PRIMARY KEY""
            if field.get_internal_type () in (""IdentityAutoField"", ""IdentityBigAutoField""):
                sql + = ""GENERATED ALWAYS AS IDENTITY""
        elif field.unique:
            sql + = ""UNIQUE""

I can also send our code

best regards
Michael Kany"	New feature	new	Database layer (models, ORM)	2.2	Normal		postgres generated identity		Unreviewed	0	0	0	0	0	0
