Monday, December 12, 2016

Re: application of migration fails

I can see why django is crashing at   File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql/introspection.py", line 178, in get_constraints

If I run the query at that line in postgres, I get the following response:
                    constraint_name                    |      column_name       | constraint_type |               array               
-------------------------------------------------------+------------------------+-----------------+-----------------------------------
 eveshoppinglist_buildline_shopping_list_id_fkey       | shopping_list_id       | FOREIGN KEY     | {eveshoppinglist_shoppinglist.id}
 eveshoppinglist_buildline_item_type_id_fkey           | item_type_id           | FOREIGN KEY     | {invTypes.typeID}
 eveshoppinglist_buildline_build_location_type_id_fkey | build_location_type_id | FOREIGN KEY     | {invTypes.typeID}
 eveshoppinglist_buildline_pkey                        | id                     | PRIMARY KEY     | {eveshoppinglist_buildline.id}

However, when I fetch the results of that query from python via psycopg2 I get:
['eveshoppinglist_buildline_shopping_list_id_fkey', 'shopping_list_id', 'FOREIGN KEY', ['eveshoppinglist_shoppinglist.id']]
['eveshoppinglist_buildline_item_type_id_fkey', 'item_type_id', 'FOREIGN KEY', []]
['eveshoppinglist_buildline_build_location_type_id_fkey', 'build_location_type_id', 'FOREIGN KEY', []]
['eveshoppinglist_buildline_pkey', 'id', 'PRIMARY KEY', ['eveshoppinglist_buildline.id']]

In the 2nd and 3rd rows, the final value is an empty list, but in both lines should contain 'invTypes.typeID'. Because this result is empty, used_cols[0] raises an exception.

So what I need to figure out is, why this query response fails to transfer to python, and is the problem within psycopg2, or is it a bad query from django. My initial hypothesis is that its because the unmanaged table+column names are not entirely lower case.

For reference, this occurs with psycopg2 versions 2.6.1 and 2.6.2 and django 1.10.3 and 1.10.4.

More anon...




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/82905960-4433-4a68-84e7-ddc098641142%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment