I created a table that has a column in that needs to contain a full
Unix file path. Since 2048 was too long for a VARCHAR, I made it
TEXT. I since populated the table. Now I want to make the path
column a primary key, and I can't figure out how. (I googled the
web and groups without luck, looked over the reference manual also,
especially reading the entry on BLOBs.)
I was able to make a fulltext index with:
create fulltext index path_idx on the_table (path);
But my attempts to make a primary key have failed:
SQL> alter table the_table add primary key (path);
BLOB column 'path' used in key specification without a key length
SQL> alter table the_table add primary key (path(2048));
Incorrect sub part key. The used key part isn't a string, the used length
is longer than the key part or the table handler doesn't support unique sub keys
SQL> alter table the_table add constraint unique (path);
BLOB column 'path' used in key specification without a key length
Actually, having made the index, all I care about is the unique constraint.
How do I do that?
--
Peter Scott
Unix file path. Since 2048 was too long for a VARCHAR, I made it
TEXT. I since populated the table. Now I want to make the path
column a primary key, and I can't figure out how. (I googled the
web and groups without luck, looked over the reference manual also,
especially reading the entry on BLOBs.)
I was able to make a fulltext index with:
create fulltext index path_idx on the_table (path);
But my attempts to make a primary key have failed:
SQL> alter table the_table add primary key (path);
BLOB column 'path' used in key specification without a key length
SQL> alter table the_table add primary key (path(2048));
Incorrect sub part key. The used key part isn't a string, the used length
is longer than the key part or the table handler doesn't support unique sub keys
SQL> alter table the_table add constraint unique (path);
BLOB column 'path' used in key specification without a key length
Actually, having made the index, all I care about is the unique constraint.
How do I do that?
--
Peter Scott
Comment