Limiting the text size on text fields

View: New views
3 Messages — Rating Filter:   Alert me  

Limiting the text size on text fields

by Ganesh's screen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there a way to restrict the length of text field in MySQL. For example, it is of 65K limit and could hold more than 20000 characters. Is there a way to restrict that to 4000 characters at table/field level. Coz the max_allowed_packet constrainted the entire DB.

Thanks
Ganesh

Re: Limiting the text size on text fields

by Sebastian Mendel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ganesh's screen schrieb:
> Is there a way to restrict the length of text field in MySQL. For example, it
> is of 65K limit and could hold more than 20000 characters. Is there a way to
> restrict that to 4000 characters at table/field level. Coz the
> max_allowed_packet constrainted the entire DB.

you can specify the maximum length only on these field types:

 CHAR(length)
 VARCHAR(length)
 BINARY(length)
 VARBINARY(length)

--
Sebastian


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=lists@...


Re: Limiting the text size on text fields

by Ganesh's screen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you, Sebastian. Also does the usage of UTF-8 over Latin1 restraints the usage or extensibility?

Sebastian Mendel wrote:
Ganesh's screen schrieb:
> Is there a way to restrict the length of text field in MySQL. For example, it
> is of 65K limit and could hold more than 20000 characters. Is there a way to
> restrict that to 4000 characters at table/field level. Coz the
> max_allowed_packet constrainted the entire DB.

you can specify the maximum length only on these field types:

 CHAR(length)
 VARCHAR(length)
 BINARY(length)
 VARBINARY(length)

--
Sebastian


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=lists@nabble.com