#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    155
    Rep Power
    12

    Primary Key useage


    Hi all. I've built the following table:
    Code:
    CREATE TABLE wms_users (user_id int4 PRIMARY KEY,
            firstname character varying(255) NOT NULL,
            lastname character varying(255) NOT NULL, 
            username character varying(25) NOT NULL, 
            password character varying(32) NOT NULL, 
            email character varying(255) NOT NULL,   
            clearance integer DEFAULT 1,
            hint integer,
            answer character varying(255),
            status integer DEFAULT 1 NOT NULL,
            added timestamp(0) without time zone DEFAULT now() NOT NULL
    );
    but when I try to execute the following insert statement:
    Code:
    insert into wms_users (firstname,lastname,username,password,email,clearance,status) values ('Debra','Bilous','debra','password','bilousd@unbc.ca',2,1);
    I get the following error message:
    ExecAppend: Fail to add null value in not null attribute user_id

    I seem to remember in MySQL being able to define a column as a primary key and an insert statment as I've used above would have worked.

    Can anyone tell me why I'm getting this error?

    Thanks in advance,
    Pablo
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    Hey Pablo,

    I already caught you back at Tek-Tips .
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com

IMN logo majestic logo threadwatch logo seochat tools logo