Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 80696 invoked from network); 16 Dec 2004 16:10:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Dec 2004 16:10:35 -0000 Received: (qmail 3825 invoked by uid 500); 16 Dec 2004 16:10:34 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 3788 invoked by uid 500); 16 Dec 2004 16:10:33 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: List-Id: Reply-To: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 3774 invoked by uid 99); 16 Dec 2004 16:10:33 -0000 Received-SPF: pass (hermes.apache.org: local policy) Received: from brmea-mail-3.Sun.COM (HELO brmea-mail-3.sun.com) (192.18.98.34) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 16 Dec 2004 08:09:18 -0800 Received: from phys-bur-1 ([129.148.9.72]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id iBGG8kVu007618 for ; Thu, 16 Dec 2004 09:08:46 -0700 (MST) Received: from conversion-daemon.bur-mail1.east.sun.com by bur-mail1.east.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0I8T00501OSH9U@bur-mail1.east.sun.com> (original mail from Lance.Andersen@Sun.COM) for derby-dev@db.apache.org; Thu, 16 Dec 2004 11:08:46 -0500 (EST) Received: from [127.0.0.1] (vpn-129-150-64-190.East.Sun.COM [129.150.64.190]) by bur-mail1.east.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTPA id <0I8T00341OUKLT@bur-mail1.east.sun.com>; Thu, 16 Dec 2004 11:08:46 -0500 (EST) Date: Thu, 16 Dec 2004 11:08:49 -0500 From: "Lance J. Andersen" Subject: Re: [PATCH] Change all Identifier Limitations to 128 In-reply-to: <41C1B0EA.5030100@hug.cx> To: Philipp Hug Cc: Derby Development Message-id: <41C1B311.4070203@sun.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) References: <41BCAF05.7090006@hug.cx> <41C1AD94.5010801@hug.cx> <41C1AF89.7060201@sun.com> <41C1B0EA.5030100@hug.cx> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N +1 IMHO. Regards Lance Philipp Hug wrote: > Ok, I could create a new patch that also renames DB2_ into DERBY_ and > renames DB2Limit into DerbyLimit. > How does that sound? > > philipp > > Lance J. Andersen wrote: > >> If the changes being made differ from the DB2 limits, and it does >> make sense to change this now that Derby is part of apache, I would >> pull the constants out of DB2Limit.java as this seems confusing from >> the outside looking in. >> >> >> >> Philipp Hug wrote: >> >>> this patch changes maximum length of column names, index/contraint >>> names, cursor names and schema names to 128 and keeps >>> MaxUserNameLength at 30. >>> it also fixes the metadata to return correct values >>> >>> philipp >>> Philipp Hug wrote: >>> >>>> I know this has been discussed before, but there hasn't been a >>>> consus if those limitations should be extended... >>>> At the moment, I patched Derby to allow longer identifier for >>>> index/constraint names, because the CMP engine I'm using, uses >>>> getMaxColumnNameLength() as limitation for index name. >>>> Does anyone know of any metadata attribute that would specify the >>>> maximum allowed length for an index/constraint name? If there is >>>> such an attribute, I could live with that and would just fix the >>>> CMP engine? Otherwise we should really think about extending it to >>>> a decent value (e.g. 30 or 128). >>>> >>>> btw: cloudscape 9 didn't have this limitation, it has been added in >>>> cloudscape 10/derby >>>> >>>> greets >>>> philipp >>>> >>> ------------------------------------------------------------------------ >>> >>> >>> Index: java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj >>> =================================================================== >>> --- java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj >>> (revision 111709) >>> +++ java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj >>> (working copy) >>> @@ -2648,8 +2648,8 @@ >>> String cursorName = null; >>> } >>> { >>> - //cursor names are limited to 18 characters >>> - cursorName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18, true) >>> + //cursor names are limited to 128 characters >>> + cursorName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> { return (FromTable) nodeFactory.getNode( >>> C_NodeTypes.CURRENT_OF_NODE, >>> @@ -3240,8 +3240,8 @@ >>> */ >>> >>> /* identifier() used to be columnName() */ >>> - //unqualified column names are limited to 30 characters >>> - columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, >>> true) + //unqualified column names are limited to 128 characters >>> + columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, >>> true) ( typeDescriptor = dataTypeDDL() ) >>> [ defaultNode = defaultAndConstraints(typeDescriptor, >>> tableElementList, columnName, autoIncrementInfo) ] >>> @@ -4115,7 +4115,7 @@ >>> //limit the qualifiedId to the id length limit passed to >>> this method >>> checkIdentifierLengthLimit(qualifiedId, id_length_limit); >>> if (schemaName != null) >>> - checkIdentifierLengthLimit(schemaName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30); >>> + checkIdentifierLengthLimit(schemaName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128); >>> >>> return (TableName) nodeFactory.getNode( >>> nodeType, >>> @@ -4418,8 +4418,8 @@ >>> } >>> { >>> /* identifier() used to be columnName() */ >>> - //unqualified column names are limited to 30 characters >>> - [ ] columnName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, true) >>> + //unqualified column names are limited to 128 characters >>> + [ ] columnName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> { >>> return columnName; >>> } >>> @@ -6402,10 +6402,10 @@ >>> columnName = thirdName; >>> } >>> >>> - //column name and schema name can not be longer than 30 >>> characters and table name can not be longer than 128 characters >>> - checkIdentifierLengthLimit(columnName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30); >>> + //column name, schema name and table name can not be longer >>> than 128 characters >>> + checkIdentifierLengthLimit(columnName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128); >>> if (schemaName != null) >>> - checkIdentifierLengthLimit(schemaName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30); >>> + checkIdentifierLengthLimit(schemaName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128); >>> if (tableName != null) >>> checkIdentifierLengthLimit(tableName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128); >>> >>> @@ -6549,10 +6549,10 @@ >>> columnName = thirdName; >>> } >>> >>> - //column name and schema name can not be longer than 30 >>> characters and correlation name can not be longer than 128 characters >>> - checkIdentifierLengthLimit(columnName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30); >>> + //column name, schema name and correlation name can not be >>> longer than 128 characters >>> + checkIdentifierLengthLimit(columnName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128); >>> if (schemaName != null) >>> - checkIdentifierLengthLimit(schemaName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30); >>> + checkIdentifierLengthLimit(schemaName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128); >>> if (correlationName != null) >>> checkIdentifierLengthLimit(correlationName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128); >>> return (OrderByColumn) nodeFactory.getNode( >>> @@ -6632,8 +6632,8 @@ >>> } >>> { >>> /* identifier() used to be columnName() */ >>> - //unqualified column names are limited to 30 characters >>> - columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, >>> true) >>> + //unqualified column names are limited to 128 characters >>> + columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, >>> true) >>> { >>> columnList.addElement(columnName); >>> } >>> @@ -7681,8 +7681,8 @@ >>> } >>> { >>> /* identifier() used to be columnName() */ >>> - //unqualified column names are limited to 30 characters >>> - columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, >>> true) >>> + //unqualified column names are limited to 128 characters >>> + columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, >>> true) >>> { >>> /* >>> ** Store the column names for the result columns in the >>> @@ -7719,7 +7719,7 @@ >>> } >>> { >>> /* identifier never ends with a space; appending a space meaning >>> desc */ >>> - columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, >>> true) [ | {columnName = columnName + ' ';}] >>> + columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, >>> true) [ | {columnName = columnName + ' ';}] >>> { >>> /* >>> ** Store the column names for the index columns in the >>> @@ -8310,7 +8310,7 @@ >>> ** We are not currently handling character set >>> ** specifications for schema, or schema bodies. >>> */ >>> - schemaName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, true) >>> + schemaName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> { >>> >>> if (schemaName.startsWith("SYS")) >>> @@ -8461,7 +8461,7 @@ >>> ** production to get the grammar to work... >>> */ >>> [ unique = unique() ] >>> - indexName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) tableName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> + indexName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) tableName >>> = qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> indexColumnList(indexColumnList) >>> >>> [ properties = propertyList()] >>> { >>> @@ -8709,7 +8709,7 @@ >>> Object[] functionElements = new Object[9]; >>> } >>> { >>> - functionName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) >>> + functionName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> functionElements[0] = functionParameterList() >>> functionElements[8] = dataTypeCommon() ( >>> routineElement(false, functionElements) ) + >>> @@ -8839,7 +8839,7 @@ >>> Vector refClause = null; >>> } >>> { >>> - triggerName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) >>> + triggerName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> isBefore = beforeOrAfter() >>> triggerEvent = triggerEvent(triggerColumns) // { >>> INSERT | DELETE | UPDATE [ colList ] } >>> tableName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> @@ -9491,7 +9491,7 @@ >>> } >>> { >>> /* changed constraintName() to qualifiedName() for compaction */ >>> - constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) >>> + constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> { >>> return constraintName; >>> } >>> @@ -9599,7 +9599,7 @@ >>> String newIndexName; >>> } >>> { >>> - oldIndexName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18, true) >>> newIndexName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18, true) >>> + oldIndexName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> newIndexName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> { >>> QueryTreeNode qtn = nodeFactory.getNode( >>> C_NodeTypes.RENAME_NODE, >>> @@ -9889,7 +9889,7 @@ >>> String schemaName; >>> } >>> { >>> - schemaName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, >>> true) >>> + schemaName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, >>> true) >>> { >>> return (QueryTreeNode) nodeFactory.getNode( >>> C_NodeTypes.SET_SCHEMA_NODE, >>> @@ -9917,7 +9917,7 @@ >>> | schemaName = string() >>> { >>> /* Max length for schema name is >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128 */ >>> - checkIdentifierLengthLimit(schemaName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30); >>> + checkIdentifierLengthLimit(schemaName, >>> DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128); >>> return (QueryTreeNode) nodeFactory.getNode( >>> C_NodeTypes.SET_SCHEMA_NODE, >>> schemaName, >>> @@ -10456,7 +10456,7 @@ >>> String schemaName; >>> } >>> { >>> - schemaName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, true) >>> + schemaName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> { >>> QueryTreeNode stmt = nodeFactory.getNode( >>> C_NodeTypes.DROP_SCHEMA_NODE, >>> @@ -10557,7 +10557,7 @@ >>> String newColumnName; >>> } >>> { >>> - oldColumnName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, true) >>> newColumnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, true) >>> + oldColumnName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> newColumnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> { >>> return (QueryTreeNode) nodeFactory.getNode( >>> C_NodeTypes.RENAME_NODE, >>> @@ -10600,7 +10600,7 @@ >>> return lockGranularity; >>> } >>> | >>> - [ ] columnName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, true) >>> + [ ] columnName = >>> identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, true) >>> typeDescriptor = DB2AlterColumn(autoIncrementInfo) >>> { >>> changeType[0] = CreateStatementNode.MODIFY_TYPE; >>> @@ -10660,7 +10660,7 @@ >>> TableElementNode tn; >>> } >>> { >>> - columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30, >>> true) tn = columnAlterClause(columnName) >>> + columnName = identifier(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128, >>> true) tn = columnAlterClause(columnName) >>> { >>> return tn; >>> } >>> @@ -10763,7 +10763,7 @@ >>> { >>> LOOKAHEAD( {getToken(2).kind == CONSTRAINT} ) >>> /* changed constraintName() to qualifiedName() for compaction */ >>> - constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) >>> + constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> { >>> return (TableElementNode) nodeFactory.getNode( >>> C_NodeTypes.CONSTRAINT_DEFINITION_NODE, >>> @@ -10795,7 +10795,7 @@ >>> } >>> | >>> LOOKAHEAD( {getToken(2).kind == FOREIGN} ) >>> - constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) >>> + constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> { >>> return (TableElementNode) nodeFactory.getNode( >>> C_NodeTypes.CONSTRAINT_DEFINITION_NODE, >>> @@ -10812,7 +10812,7 @@ >>> } >>> | >>> LOOKAHEAD( {getToken(2).kind == UNIQUE} ) >>> - constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) >>> + constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> { >>> return (TableElementNode) nodeFactory.getNode( >>> C_NodeTypes.CONSTRAINT_DEFINITION_NODE, >>> @@ -10828,7 +10828,7 @@ >>> ); >>> } >>> | >>> - constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) >>> + constraintName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> { >>> return (TableElementNode) nodeFactory.getNode( >>> C_NodeTypes.CONSTRAINT_DEFINITION_NODE, >>> @@ -10874,7 +10874,7 @@ >>> TableName indexName; >>> } >>> { >>> - indexName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) >>> + indexName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> { >>> return (QueryTreeNode) nodeFactory.getNode( >>> C_NodeTypes.DROP_INDEX_NODE, >>> @@ -10940,7 +10940,7 @@ >>> TableName triggerName; >>> } >>> { >>> - triggerName = >>> qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18) + >>> triggerName = qualifiedName(DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128) >>> { >>> return (QueryTreeNode) nodeFactory.getNode( >>> C_NodeTypes.DROP_TRIGGER_NODE, >>> Index: >>> java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java >>> =================================================================== >>> --- >>> java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java >>> (revision 111709) >>> +++ >>> java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java >>> (working copy) >>> @@ -1108,7 +1108,7 @@ >>> * @return max literal length >>> */ >>> public int getMaxColumnNameLength() { >>> - return DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30; >>> + return DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128; >>> } >>> >>> /** >>> @@ -1173,7 +1173,7 @@ >>> * @return max cursor name length in bytes >>> */ >>> public int getMaxCursorNameLength() { >>> - return DB2Limit.DB2_MAX_IDENTIFIER_LENGTH18; >>> + return DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128; >>> } >>> >>> /** >>> @@ -1191,7 +1191,7 @@ >>> * @return max name length in bytes >>> */ >>> public int getMaxSchemaNameLength() { >>> - return DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30; >>> + return DB2Limit.DB2_MAX_IDENTIFIER_LENGTH128; >>> } >>> >>> /** >>> @@ -1274,7 +1274,7 @@ >>> * @return max name length in bytes >>> */ >>> public int getMaxUserNameLength() { >>> - return DB2Limit.DB2_MAX_IDENTIFIER_LENGTH30; >>> + return DB2Limit.MAX_USERID_LENGTH; >>> } >>> >>> >>> //---------------------------------------------------------------------- >>> >>> Index: java/engine/org/apache/derby/iapi/reference/DB2Limit.java >>> =================================================================== >>> --- java/engine/org/apache/derby/iapi/reference/DB2Limit.java >>> (revision 111709) >>> +++ java/engine/org/apache/derby/iapi/reference/DB2Limit.java >>> (working copy) >>> @@ -53,12 +53,7 @@ >>> // SQLCAMESSAGE procedure. See org.apache.derby.impl.sql.catalog. >>> public static final int DB2_JCC_MAX_EXCEPTION_PARAM_LENGTH = 2400; >>> >>> - /* Some identifiers like Constraint name, Cursor name, Function >>> name, Index name, Trigger name >>> - * are limited to 18 character in DB2*/ >>> - public static final int DB2_MAX_IDENTIFIER_LENGTH18 = 18; >>> - /* Some identifiers like Column name, Schema name are limited >>> to 30 characters in DB2*/ >>> - public static final int DB2_MAX_IDENTIFIER_LENGTH30 = 30; >>> - /* Some identifiers like Savepoint names, Table names, view >>> names etc are limited to 128 characters in DB2*/ >>> + /* Some identifiers like Constraint name, Cursor name, Function >>> name, Index name, Trigger name, Column name, Schema name, Savepoint >>> names, Table names, view names etc are limited to 128 characters in >>> DB2*/ >>> public static final int DB2_MAX_IDENTIFIER_LENGTH128 = 128; >>> public static final int DB2_CHAR_MAXWIDTH = 254; >>> public static final int DB2_VARCHAR_MAXWIDTH = 32672; >>> >>>