By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,586 Members | 623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,586 IT Pros & Developers. It's quick & easy.

varchar and unique

P: n/a
Hi @all

i try to create a ssh public key database on a mysql-5.0.16 DB

the problem is the size of the varchar, i want a size 1024...

mysql> create table sshkeys ( absid integer unsigned zerofill NOT NULL
auto_increment, rsa varchar(1024) UNIQUE NULL, dsa varchar(1024) UNIQUE
NULL, PRIMARY KEY(absid) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ERROR 1005 (HY000): Can't create table './test/sshkeys.frm' (errno:
139)

it runs fine without unique :-(

mysql> create table sshkeys ( absid integer unsigned zerofill NOT NULL
auto_increment, rsa varchar(1024) NULL, dsa varchar(1024) NULL, PRIMARY
KEY(absid) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.07 sec)

with unique a can create varchar fields with a size ~700

is it a bug or a feature of mysql ? :-)

background of the table:
a system has rsa or dsa key, or both
has a system only one type, the entry in the other type is NULL.
Another table has a forgein key reference to the sshkeys table, this
table contains the system name or alias name.

Thanks for help

Frank

Dec 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<ro*****@web.de> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
it runs fine without unique :-(

mysql> create table sshkeys ( absid integer unsigned zerofill NOT NULL
auto_increment, rsa varchar(1024) NULL, dsa varchar(1024) NULL, PRIMARY
KEY(absid) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.07 sec)

with unique [i] can create varchar fields with a size ~700


http://dev.mysql.com/doc/refman/5.0/...te-index.html:
"Prefixes can be up to 1000 bytes long (767 bytes for InnoDB tables)."

Regards,
Bill K.
Dec 19 '05 #2

P: n/a
Hi,

I didn't even think that a varchar field can take 700 characters - I
thought, the limit was 512.

However, I guess, a text field might be more suitable for this.

Markus
Dec 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.