Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 20459 invoked from network); 16 Dec 2004 19:25:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Dec 2004 19:25:20 -0000 Received: (qmail 99754 invoked by uid 500); 16 Dec 2004 19:25:19 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 99721 invoked by uid 500); 16 Dec 2004 19:25:19 -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 99698 invoked by uid 99); 16 Dec 2004 19:25:19 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=UPPERCASE_25_50 X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of philipp@hug.cx designates 193.246.120.14 as permitted sender) Received: from shopwall.abacus.ch (HELO shopwall.abacus.ch) (193.246.120.14) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 16 Dec 2004 11:22:36 -0800 Received: from postman.abacus.ch by shopwall.abacus.ch via smtpd (for hermes.apache.org [209.237.227.199]) with ESMTP; Thu, 16 Dec 2004 20:22:32 +0100 Received: from localhost (localhost [127.0.0.1]) by postman.abacus.ch (Postfix) with ESMTP id E9FD212F8A3; Thu, 16 Dec 2004 16:57:57 +0100 (CET) Received: from postman.abacus.ch ([127.0.0.1]) by localhost (postman [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06519-01-7; Thu, 16 Dec 2004 16:57:45 +0100 (CET) Received: from [172.16.34.83] (unknown [172.16.34.83]) by postman.abacus.ch (Postfix) with ESMTP id 7B76012F873; Thu, 16 Dec 2004 16:57:45 +0100 (CET) Message-ID: <41C1B0EA.5030100@hug.cx> Date: Thu, 16 Dec 2004 16:59:38 +0100 From: Philipp Hug User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Lance J. Andersen" Cc: Derby Development Subject: Re: [PATCH] Change all Identifier Limitations to 128 References: <41BCAF05.7090006@hug.cx> <41C1AD94.5010801@hug.cx> <41C1AF89.7060201@sun.com> In-Reply-To: <41C1AF89.7060201@sun.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at abacus.ch X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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; >> >>