Subject | Zero prefix results in primary key constraint violation |
---|---|
Author | lutteroth89@ymail.com |
Post date | 2009-02-10T02:23:24Z |
Hi!
I am executing the following SQL code:
CREATE DATABASE 'keytest.fdb' user 'sysdba' password 'masterkey';
CREATE TABLE test
(
Id VARCHAR(16) CHARACTER SET OCTETS NOT NULL,
PRIMARY KEY (Id)
);
COMMIT;
INSERT INTO test VALUES (ASCII_CHAR(1));
INSERT INTO test VALUES (ASCII_CHAR(1) || ASCII_CHAR(0));
The second INSERT gives me a:
Statement failed, SQLCODE = -803
violation of PRIMARY or UNIQUE KEY constraint "INTEG_2" on table "TEST"
Why is that? The octet strings 01hex and 0100hex are clearly two
different keys.
Cheers,
Christof
I am executing the following SQL code:
CREATE DATABASE 'keytest.fdb' user 'sysdba' password 'masterkey';
CREATE TABLE test
(
Id VARCHAR(16) CHARACTER SET OCTETS NOT NULL,
PRIMARY KEY (Id)
);
COMMIT;
INSERT INTO test VALUES (ASCII_CHAR(1));
INSERT INTO test VALUES (ASCII_CHAR(1) || ASCII_CHAR(0));
The second INSERT gives me a:
Statement failed, SQLCODE = -803
violation of PRIMARY or UNIQUE KEY constraint "INTEG_2" on table "TEST"
Why is that? The octet strings 01hex and 0100hex are clearly two
different keys.
Cheers,
Christof