db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: How to modify the SQLParser to handle NULL in column definitions ?
Date Thu, 10 Aug 2006 23:37:46 GMT

This is a developer question which should be posted on derby-dev.
Anyway, although I know there are databases which allow you to specify
nullability by the keyword NULL (which is redundant since columns are
nullable unless given a NOT NULL constraint), this is *not* a part of
the SQL standard. The create statement below should be written

create testtable(
    code int   NOT NULL,
    description varchar(32)

which would be more portable since it then would be standard compliant.

Duncan Groenewald wrote:
> Can anyone provide a pointer as to what needs to be modified in order
> for derby to handle a column definition that includes a NULL, as shown
> below:
> create testtable(
>    code int   NOT NULL,
>    description varchar(32) NULL
> )
> I have no real idea how the parser works but figured it can't be that
> hard to be able to handle this without complaining about a syntax
> error.  It looks to me like this gets done in the SQLParser.java file
> but I have not been able to figure out how it works.  There is also a
> sqlgrammar.jj file which I assume is not actually used for anything
> although it looks like it might be some kind of definition file for
> SQLParser.
> Thanks in advance.
> Duncan

Bernt Marius Johnsen, Database Technology Group,
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway

View raw message