#32132: ManyToMany field does not respect the PositiveBigIntegerField as ID
-------------------------------------+-------------------------------------
               Reporter:  Kfir       |          Owner:  nobody
  Breger                             |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:  models, orm
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When creating a relation between 2 models using PositiveBigIntegerField on
 Postgresql, the relation table is created using regular ints as the column
 type. This in turn leads to out of bound error when using large numbers
 for ids.

 {{{
 from django.contrib.gis.db import models

 class Node(models.Model):
     id = models.PositiveBigIntegerField(primary_key=True)
     point = models.PointField()

 class Relation(models.Model):
    id = models.PositiveBigIntegerField(primary_key=True)
    nodes = models.ManyToManyField(Node)

 }}}

 The generated table will look like this:
 {{{
    Column    |  Type   | Collation | Nullable |                    Default
 | Storage | Stats target | Description
 
-------------+---------+-----------+----------+------------------------------------------------+---------+--------------+-------------
  id          | integer |           | not null |
 nextval('osm_relation_nodes_id_seq'::regclass) | plain   |              |
  relation_id | integer |           | not null |
 | plain   |              |
  node_id     | integer |           | not null |
 | plain   |              |
 }}}

 As you can see, the PositiveBigInteger is not respected and a regular int
 is set

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32132>
Django <https://code.djangoproject.com/>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.11a2e738ce5a4727ef31c9e48e91a08c%40djangoproject.com.

Reply via email to