﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
9862	Non-standard SQL generated in column definition for nullable columns in create table DDL	Ambrish	Malcolm Tredinnick	"Hi,

While doing backend testing for new DB2 adapter (I am developing it), I found that in CREATE TABLE DDL generation, it contains some non-standard SQL syntax.

Here is one example of model.
    
{{{
class User(models.Model):
    first_name = models.CharField(max_length=20, null=False)
    last_name = models.CharField(max_length=20, null=True)

    class Meta:
        db_table = ""temp_user""
}}}

For the column '''last_name''', the SQL that gets generated is '''LAST_NAME VARCHAR(20) NULL'''. The trailing '''NULL''' is not a standard SQL. This can be validated by the SQL validator tool - http://developer.mimer.com/validator/parser200x/index.tml Needless to say, this will fail in DB2 and so too in Oracle.


I find only one method in the docs which deals with the table DDL generation '''BaseDatabaseCreation.sql_create_model'''.

Regards,[[BR]]
Ambrish Bhargava "		closed	Database layer (models, ORM)	1.0		fixed		gabor@…	Accepted	1	0	0	0	0	0
