CREATE TABLE TABLE1(USER_ID INT NOT NULL PRIMARY KEY );
INSERT INTO TABLE1 (USER_ID) VALUES (1);
INSERT INTO TABLE1 (USER_ID) VALUES (2);
INSERT INTO TABLE1 (USER_ID) VALUES (3);
INSERT INTO TABLE1 (USER_ID) VALUES (4);
COMMIT;
CREATE TABLE TABLE2(USER_ID INT NOT NULL, COLUMN2 SMALLINT DEFAULT 0 NOT NULL,
 COLUMN3 CHARACTER(10) DEFAULT 'TEST') ;
COMMIT;
ALTER TABLE TABLE2 ADD CONSTRAINT USER_FK FOREIGN KEY (USER_ID) REFERENCES TABLE1(USER_ID);
CREATE INDEX USER_FK ON TABLE2(USER_ID);
INSERT INTO TABLE2 (USER_ID) VALUES ( 1 ) ;
COMMIT;
INSERT INTO TABLE2 (USER_ID) VALUES ( 2 ) ;
COMMIT;
INSERT INTO TABLE2 (USER_ID) VALUES ( 3 ) ;
COMMIT;
INSERT INTO TABLE2 (USER_ID) VALUES ( 4 ) ;
COMMIT;
UPDATE TABLE2 SET COLUMN2=15 WHERE USER_ID=3;
COMMIT;
/*c4*/SELECT * FROM TABLE1;
/*c4*/SELECT * FROM TABLE2;
/*c1*/SELECT * FROM TABLE2 WHERE COLUMN2=15;

-- bug #1110517
DROP TABLE FILE2 IF EXISTS;
CREATE TABLE FILE2(ID VARCHAR(10) PRIMARY KEY,NAME
  VARCHAR(10),DESCRIPTION VARCHAR(10), field1 INT, field2
  VARCHAR(10));
-- DESCRIPTION must be NULL
/*u1*/insert into file2(id, name) values('14', 'dir');
/*u1*/update file2 set name = 'newdir' where id = '14';

SHUTDOWN IMMEDIATELY;
