* <A NAME="indexDefinition">indexDefinition</A>
*/
final public StatementNode indexDefinition() throws ParseException, StandardException {
Boolean unique = Boolean.FALSE;
Properties properties = null;
TableName indexName;
TableName tableName;
Vector indexColumnList = new Vector();
switch (jj_nt.kind) {
case UNIQUE:
unique = unique();
break;
default:
jj_la1[235] = jj_gen;
;
}
jj_consume_token(INDEX);
indexName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
jj_consume_token(ON);
tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
jj_consume_token(LEFT_PAREN);
indexColumnList(indexColumnList);
jj_consume_token(RIGHT_PAREN);
switch (jj_nt.kind) {
case DERBYDASHPROPERTIES:
properties = propertyList(false);
jj_consume_token(CHECK_PROPERTIES);
break;
default:
jj_la1[236] = jj_gen;
;
}
/* User allowed to specify schema name on table and index.
* If no schema name specified for index, then it "inherits"
* its schema name from the table.
* If index has a schema name and table does not, then
* table "inherits" its schema name from the index.
* If schema names are specified for both objects, then the
* schema names must be the same.
*/
if (indexName.getSchemaName() == null)
{
indexName.setSchemaName(tableName.getSchemaName());
}
else if (tableName.getSchemaName() == null)
{
tableName.setSchemaName(indexName.getSchemaName());
}
else
{
/* schema name specified for both */
if (! (indexName.getSchemaName().equals(
tableName.getSchemaName())))
{
{if (true) throw StandardException.newException(SQLState.LANG_INDEX_AND_TABLE_IN_DIFFERENT_SCHEMAS,
indexName,
tableName);}
}