if ( rc.hasGenerationClause() )
{
ColumnDescriptor colDesc = rc.getTableColumnDescriptor();
DataTypeDescriptor dtd = colDesc.getType();
DefaultInfo di = colDesc.getDefaultInfo();
ValueNode generationClause = parseGenerationClause( di.getDefaultText(), targetTableDescriptor );
// insert CAST in case column data type is not same as the
// resolved type of the generation clause
generationClause = (ValueNode) getNodeFactory().getNode
(
C_NodeTypes.CAST_NODE,
generationClause,
dtd,
getContextManager()
);
// Assignment semantics of implicit cast here:
// Section 9.2 (Store assignment). There, General Rule
// 2.b.v.2 says that the database should raise an exception
// if truncation occurs when stuffing a string value into a
// VARCHAR, so make sure CAST doesn't issue warning only.
((CastNode)generationClause).setAssignmentSemantics();
//
// Unqualified function references should resolve to the
// current schema at the time that the table was
// created/altered. See DERBY-3945.
//
SchemaDescriptor originalCurrentSchema = getSchemaDescriptor( di.getOriginalCurrentSchema(), true );
compilerContext.pushCompilationSchema( originalCurrentSchema );
try {
bindRowScopedExpression( getNodeFactory(), getContextManager(), targetTableDescriptor, sourceRCL, generationClause );
}