db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5235) Remove the artificial limit on the length of VARCHAR values, allowing them to be java.lang.Integer.MAX_VALUE long
Date Tue, 24 May 2011 15:34:51 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038631#comment-13038631

Rick Hillegas commented on DERBY-5235:

Continuing the discussion of what our character types might be:

The SQL distinction between VARCHAR and CLOB might map naturally onto the Java distinction
between Strings and character streams. Java Strings are limited to Integer.MAX_VALUE characters.
Character streams have unbounded length.

This distinction, of course, doesn't make sense in Derby today. A Derby CLOB is limited to
Integer.MAX_VALUE characters even though java.sql.Clob supports up to Long.MAX_VALUE characters.
Probably a substantial amount of work would be needed to support CLOBs longer than Integer.MAX_VALUE.

If we adopted this approach,  we could give users the following advice:

LONG VARCHAR - Deprecated. Supported for backward compatibility.

VARCHAR - Use this type if you won't exceed Integer.MAX_VALUE characters. Corresponds to java.lang.String.

CLOB - Use this type if you need more than Integer.MAX_VALUE characters. Corresponds to java.io.Reader.

Implications of this approach would include:

o We would maintain the current (SQL Standard) behavior of not supporting CLOBs in sorts and
foreign keys.

o We would want to support the Standard by allowing = and <> to operate on CLOBs (see

o We would want to support indexes on long VARCHARs and otherwise handle them efficiently.

> Remove the artificial limit on the length of VARCHAR values, allowing them to be java.lang.Integer.MAX_VALUE
> -----------------------------------------------------------------------------------------------------------------
>                 Key: DERBY-5235
>                 URL: https://issues.apache.org/jira/browse/DERBY-5235
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions:
>            Reporter: Rick Hillegas
> The original Cloudscape limit for the length of VARCHAR values was java.lang.Integer.MAX_VALUE.
That is the limit in Cloudscape 5.1. Nothing in Derby should break if we restore the original
limit. The current limit is an artificial bound introduced to make Derby agree with DB2. 32672
is the upper bound on the length of a DB2 VARCHAR: http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0001029.htm

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message