Opened 13 years ago

Last modified 13 years ago

#16246 closed Bug

Small problems with new generic IP address field tests on Postgres 8.4 — at Version 1

Reported by: Ramiro Morales Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

Tes suite doesn't start to run because it can't create some permission table:

Traceback (most recent call last):
  File "./runtests.py", line 330, in <module>
    failures = django_tests(int(options.verbosity), options.interactive, options.failfast, args)
  File "./runtests.py", line 197, in django_tests
    failures = test_runner.run_tests(test_labels, extra_tests=extra_tests)
  File "django/test/simple.py", line 354, in run_tests
    old_config = self.setup_databases()
  File "django/test/simple.py", line 291, in setup_databases
    test_db_name = connection.creation.create_test_db(self.verbosity, autoclobber=not self.interactive)
  File "django/db/backends/creation.py", line 239, in create_test_db
    load_initial_data=False)
  File "django/core/management/__init__.py", line 166, in call_command
    return klass.execute(*args, **defaults)
  File "django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "django/core/management/commands/syncdb.py", line 109, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "django/core/management/sql.py", line 190, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "django/contrib/auth/management/__init__.py", line 56, in create_permissions
    content_type=ctype
  File "django/db/models/manager.py", line 138, in create
    return self.get_query_set().create(**kwargs)
  File "django/db/models/query.py", line 360, in create
    obj.save(force_insert=True, using=self.db)
  File "django/db/models/base.py", line 463, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "django/db/models/base.py", line 556, in save_base
    result = manager._insert(values, return_id=update_pk, using=using)
  File "django/db/models/manager.py", line 198, in _insert
    return insert_query(self.model, values, **kwargs)
  File "django/db/models/query.py", line 1456, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "django/db/models/sql/compiler.py", line 810, in execute_sql
    cursor = super(SQLInsertCompiler, self).execute_sql(None)
  File "django/db/models/sql/compiler.py", line 754, in execute_sql
    cursor.execute(sql, params)
  File "django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: value too long for type character varying(50)

It's the row corresponding to this test model:

https://code.djangoproject.com/browser/django/trunk/tests/modeltests/validation/models.py?rev=16366#L91

Strange thing is why people using PosgreSQL 9 doesn't see this?

Once that is fixed, then there is one error:

======================================================================
ERROR: test_v4_unpack_uniqueness_detection (modeltests.validation.tests.GenericIPAddressFieldTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/modeltests/validation/tests.py", line 175, in test_v4_unpack_uniqueness_detection
    giptm.save()
  File "django/db/models/base.py", line 463, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "django/db/models/base.py", line 556, in save_base
    result = manager._insert(values, return_id=update_pk, using=using)
  File "django/db/models/manager.py", line 198, in _insert
    return insert_query(self.model, values, **kwargs)
  File "django/db/models/query.py", line 1456, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "django/db/models/sql/compiler.py", line 810, in execute_sql
    cursor = super(SQLInsertCompiler, self).execute_sql(None)
  File "django/db/models/sql/compiler.py", line 754, in execute_sql
    cursor.execute(sql, params)
  File "django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
DatabaseError: invalid input syntax for type inet: ""
LINE 1: ..., "v4_ip", "v6_ip") VALUES (E'::ffff:10.10.10.10', E'', E'')
                                                              ^

(That causes five errors later in modeltests.serializers, modeltests.proxy_model_inheritance, modeltests.fixtures and regressiontests.bug639)

It's about the GenericIPAddressField's in that model and the one before it, because they are marked blank=True and not null=True. From whai I understand: Being Postgres the only backend that doesn't represent the new generic IP address model field with a char DDL field but with a dedicated native data type it doesn't know how to interpret '' when it is given with such value to store, at least in 8.4.

Change History (2)

by Ramiro Morales, 13 years ago

Attachment: 16246.diff added

Patch that tweaks the described test case problems, renames a clashing test method elsewhere

comment:1 by Ramiro Morales, 13 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top