[Django] #29951: Django Test Model objects creation does not get created in the right table (Postgres)

7 views
Skip to first unread message

Django

unread,
Nov 14, 2018, 3:05:07 PM11/14/18
to django-...@googlegroups.com
#29951: Django Test Model objects creation does not get created in the right table
(Postgres)
---------------------------------------------+------------------------
Reporter: jchao09 | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 2.1
Severity: Normal | Keywords: test
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
I have a model that looks like


{{{
class PeopleBio(models.Model):
person_id = models.TextField()
bio = models.TextField()

class Meta:
managed = True # it's actually based on setting IS_TESTING,
which is set to True in this case
db_table = '"ppl"."ppl_bio"'
}}}


When running test, I insert the object


{{{
PeopleBio.objects.create(person_id="person1", bio='test')
}}}


when using `cursor.fetchall()` on `ppl.ppl_bio`, it returns nothing. I
used pdb to double check, and the test table indeed doesn't have anything
in it. The Model's `db_table` is indeed `ppl.ppl_bio`, and when doing
`PeopleBio.objects.all()`, it does return something.

All leads me to believe that the Model does not point to the right
Postgres table when running test.

--
Ticket URL: <https://code.djangoproject.com/ticket/29951>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 14, 2018, 3:24:04 PM11/14/18
to django-...@googlegroups.com
#29951: Object not created in the correct table with db_table=<schema>.<table> on
PostgreSQL
-----------------------------------+--------------------------------------
Reporter: jchao09 | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 2.1
Severity: Normal | Resolution: invalid

Keywords: test | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => invalid


Comment:

Django doesn't officially support schemas. See #6148 for that. As far as I
know, the `<schema>.<table>` syntax only works on Oracle.

--
Ticket URL: <https://code.djangoproject.com/ticket/29951#comment:1>

Reply all
Reply to author
Forward
0 new messages