Re: [Django] #30511: AutoField with postgres10/11 as generated identity.

2019-05-27 Thread Django
#30511: AutoField with postgres10/11 as generated identity.
-+-
 Reporter:  Michael Kany |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  postgres generated   | Triage Stage:
  identity   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Michael Kany):

 I agree that there is not much value in replacing serial with GENERATED AS
 IDENTITY.

 What I suggest is to add extra fields related to GENERATED AS IDENTITY to
 the PostgreSQL backends as an alternative option to SERIAL since it is an
 option in PostgreSQL and it is actually SQL-standard compliant compared to
 SERIAL.

 Since PostgreSQL 10 there is the option to use GENERATED AS IDENTITY, I
 would like to suggest to make Django compatible with this feature by
 adding two extra AutoField-like fields.

 •   IdentityAutoField with inner workings like AutoField with SERIAL
 but with GENERATED AS IDENTITY
 •   IdentityBigAutoField with inner workings like BigAutoField with
 SERIAL but with GENERATED AS IDENTITY

 These fields would probably be interesting only for Postgres user.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.04986717e5dc3bcf1290212b2269ce19%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #30511: AutoField with postgres10/11 as generated identity. (was: AutoField with postgres10/11 as generated identity)

2019-05-27 Thread Django
#30511: AutoField with postgres10/11 as generated identity.
-+-
 Reporter:  Michael Kany |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  postgres generated   | Triage Stage:
  identity   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by felixxm):

 * version:  2.2 => master


Old description:

> 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 description:

 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

--

Comment:

 Thanks for the report. Can you provide more details about your use case?
 Can you also clarify what are you proposing? e.g.
 - using `GENERATED AS IDENTITY` instead of `serial` on PostgreSQL (I don't
 see much value in this),
 - adding extra fields to the PostgreSQL backends.

 In Oracle we used `GENERATED AS IDENTITY` because there is no other way to
 create `serial`-like columns on Oracle which is not the case on
 PostgreSQL.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.ea4f352abbe31e9b260855435c394b77%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #30511: AutoField with postgres10/11 as generated identity

2019-05-26 Thread Django
#30511: AutoField with postgres10/11 as generated identity
-+-
 Reporter:  Michael Kany |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  postgres generated   | Triage Stage:
  identity   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Michael Kany):

 * cc: Michael Kany (added)


Comment:

 the new Fields 'IdentityAutoField': 'integer',  'IdentityBigAutoField':
 'bigint', the new fields could also be implemented as AutoFiled or
 BigAutoField, similar to the oracle module

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.25eced313d0fd6dae1b2597fbb52c4da%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #30511: AutoField with postgres10/11 as generated identity

2019-05-26 Thread Django
#30511: AutoField with postgres10/11 as generated identity
-+-
 Reporter:  Michael Kany |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  postgres generated   | Triage Stage:
  identity   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Michael Kany):

 * Attachment "schema.py" added.


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.b3a4221f3e92413d4c5648c1635fde19%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #30511: AutoField with postgres10/11 as generated identity

2019-05-26 Thread Django
#30511: AutoField with postgres10/11 as generated identity
-+-
 Reporter:  Michael Kany |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  postgres generated   | Triage Stage:
  identity   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Michael Kany):

 * Attachment "base.py" added.


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.8b3a6d952ac741a1c11d2278eaa167d7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #30511: AutoField with postgres10/11 as generated identity

2019-05-26 Thread Django
#30511: AutoField with postgres10/11 as generated identity
-+-
   Reporter:  Michael|  Owner:  nobody
  Kany   |
   Type:  New| Status:  new
  feature|
  Component:  Database   |Version:  2.2
  layer (models, ORM)|   Keywords:  postgres generated
   Severity:  Normal |  identity
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 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

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.85058bd127809d3e64647858831c7797%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.