Mailing List Archive



Back to the month index Back to the list index

Tauren Mills (tauren@groovee.com)
Tue, 1 Apr 1997 23:14:57 -0800


Message-Id: <01BC3EF2.8735F7C0@yowza.groovee.com>
From: Tauren Mills <tauren@groovee.com>
Subject: [mSQL] Strange Field "xxx" cannot be null errors
Date: Tue, 1 Apr 1997 23:14:57 -0800

I'm having troubles with some insert commands in msql ver 2b5.
I am getting errors like these:

ERROR : Field "sort_order" cannot be null
ERROR : Index field "sort_order" cannot be NULL

Here is the version info:

Version Details :-
 
        msqladmin version 2.0 Beta 5 Pre2
        mSQL server version 2.0 Beta 5 Pre2
        mSQL protocol version 22
        mSQL connection Localhost via UNIX socket
        Target platform SunOS-4.1.4-Sparc
 
Configuration Details :-
 
        Default config file /easystreet/vdomains/es2vd136/msql2/msql.conf
        TCP socket 4333
        UNIX socket /easystreet/vdomains/es2vd136/msql2/msql2.sock
        mSQL user es2vd136
        Admin user es2vd136
        Install directory /easystreet/vdomains/es2vd136/msql2
        PID file location /easystreet/vdomains/es2vd136/msql2/msql2d.pid

I have created a database called test with the following command:
msqladmin create test

I then use the following command to create the database:
msql test < test.msql

Here is the contents of test.msql:

------<BEGIN>------------------

drop table products
\p\g

create table products (
    prod_id char(15) not null,
    cat_id char(10) not null,
    description char(50),
    short_desc char(50) not null,
    sizes int,
    colors int,
    retail real not null,
    price real,
    sale_id char(10),
    create_date int not null,
    mod_date int,
    graphic_root char(15),
    active_flag int,
    filepath char(100),
    num_opt_groups int,
    sort_order int not null
)
\p\g

CREATE UNIQUE INDEX products_idx ON products (
    prod_id
)
\p\g

CREATE INDEX products_cat_idx ON products (
    cat_id
)
\p\g

CREATE INDEX products_sort_idx ON products (
    sort_order
)
\p\g

CREATE INDEX products_active_idx ON products (
    active_flag
)
\p\g

insert into products(prod_id, cat_id, description, short_desc, sizes, colors, retail, price, sale_id, create_date, mod_date, graphic_root, active_flag, filepath, sort_order)
    values('NEZMUSIC', '2222222222', 'Nez Music Videotape', 'Nez Music',0,0,30,20,'0000000000', 1000, 1000, 'nezmusic',1,'/nezmusic.html',1)
\p\g

------<END>-------------------

Everything runs properly until the INSERT into products command. I
then get this error:
  ERROR : Field "sort_order" cannot be null

If I remove the "not null" from the definition of sort_order in the
CREATE products table, the error changes to this:
  ERROR : Index field "sort_order" cannot be NULL

If I comment out the creation of the INDEX on sort_order, the
error changes to this:
  ERROR : Index field "active_flag" cannot be NULL

If I comment out both the sort_order and the active_flag
CREATE INDEX commands, then the INSERT works correctly.

I am porting a msql 1.0 database to 2.0 and am running
into these cannot be null problems fairly frequently. I've
been working around them by not defining NOT NULL on
fields that are giving problems and by living without the
proper indexes.

What is going on? It seems like I am doing this correctly.
If not, I'd love to learn what I'm doing wrong.

Thanks for the help,
Tauren

* Groovee Creatives * Tauren Mills *
* tauren@groovee.com * PO BOX 1072 *
* http://www.groovee.com/ * Portland, OR 97207 *
* ftp://ftp.groovee.com/pub/groovee/ * TEL: 503.768.9392 *
*CGI*Java*ActiveX*NSAPI*ISAPI*SQL*C/C++*Shockwave*XTRAs*VB*Sound*


  • application/ms-tnef attachment: stored