#17957: If engine for default DB alias has interprets_empty_strings_as_nulls 
(i.e.
Oracle) it affects DDL SQL for model fields null=False in other DBs
-------------------------------------+-------------------------------------
     Reporter:  bhuztez              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  reopened
    Component:  Database layer       |                  Version:  SVN
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * cc: anssi.kaariainen@… (added)


Comment:

 There is a related test failure under Oracle:
 {{{
  ./runtests.py --settings=test_oracle test_runner
 Creating test database for alias 'default'...
 Creating test user...
 Creating test database for alias 'other'...
 Creating test user...
 ...........sError: One or more models did not validate:
 sessions.session: "session_key": Primary key fields cannot have null=True.

 E.
 ======================================================================
 ERROR: test_ticket_16885
 (regressiontests.test_runner.tests.Ticket16885RegressionTests)
 Features are also confirmed on mirrored databases.
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 "/home/akaariai/Programming/django/tests/regressiontests/test_runner/tests.py",
 line 203, in test_ticket_16885
     DjangoTestSuiteRunner(verbosity=0).setup_databases()
   File "/home/akaariai/Programming/django/tests/django/test/simple.py",
 line 306, in setup_databases
     self.verbosity, autoclobber=not self.interactive)
   File
 "/home/akaariai/Programming/django/tests/django/db/backends/creation.py",
 line 271, in create_test_db
     load_initial_data=False)
   File
 "/home/akaariai/Programming/django/tests/django/core/management/__init__.py",
 line 150, in call_command
     return klass.execute(*args, **defaults)
   File
 "/home/akaariai/Programming/django/tests/django/core/management/base.py",
 line 248, in execute
     sys.exit(1)
 SystemExit: 1
 }}}

 I believe the cause of this error is having a `CharField` with
 primary_key=True, and this leads to validation failure as pk + null=True
 isn't a valid combination.

 If I am not mistaken it would be enough to create the character fields
 with the "NOT NULL" part removed, and leaving field.null alone.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17957#comment:8>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to