Click here to get back home

varchar and unique

 HomeNewsGroups | Search

mailing.database.mysql - MySQL database issues discussed in this best MySQL group in USENET 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
varchar and unique rootman@web.de 12-19-2005
Posted by rootman@web.de on December 19, 2005, 8:13 am
Please log in for more thread options
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...

show/hide quoted text
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 :-(

show/hide quoted text
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


Posted by Bill Karwin on December 19, 2005, 3:02 pm
Please log in for more thread options
show/hide quoted text

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

Regards,
Bill K.



Posted by Markus Popp on December 19, 2005, 3:25 pm
Please log in for more thread options
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



Similar ThreadsPosted
Major diff between varchar of 70 against varchar of 100? November 4, 2005, 9:29 am
Varchar to Blob conversion July 13, 2005, 11:11 pm
Removing space in varchar November 14, 2006, 12:12 pm
Help with Stored Proc in mysql varchar variables August 29, 2006, 4:36 am
Converting VARCHAR "date" info to an actual date field August 15, 2005, 7:49 pm
getting unique records November 23, 2006, 9:58 am
inserting unique value June 21, 2007, 9:20 am
Creating an unique record id ?? October 9, 2005, 1:15 pm
Returning unique records October 27, 2005, 12:35 pm
How to get the number of each unique items? October 28, 2005, 7:43 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

Friends:

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap
Privacy Policy