Skip to content

Broken db2 sql for TASK_LOCK #500

@jvalkeal

Description

@jvalkeal

Primary key columns need to be defined as not null as shown below:

db2 => CREATE TABLE TASK_LOCK (LOCK_KEY CHAR(36), REGION VARCHAR(100), CLIENT_ID CHAR(36), CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION))
DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0542N  The column named "LOCK_KEY" cannot be a column of a primary key or 
unique key constraint because it can contain null values.  SQLSTATE=42831

db2 => CREATE TABLE TASK_LOCK (LOCK_KEY CHAR(36) NOT NULL, REGION VARCHAR(100) NOT NULL, CLIENT_ID CHAR(36), CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION))
DB20000I  The SQL command completed successfully.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions