Program: 91645
Project: 91645
Buggy source:
/** 
 * Returns a SQL statement for creating a foreigner key constraint. The returned statement is of the form:  {@preformat sqlALTER TABLE "schema"."table" ADD CONSTRAINT "table_column_fkey" FOREIGN KEY("column") REFERENCES "schema"."target" (primaryKey) ON UPDATE CASCADE ON DELETE RESTRICT}Note that the primary key is <strong>not</strong> quoted on intent. If quoted are desired, then they must be added explicitly before to call this method.
 * @param schema      the schema for both tables.
 * @param table       the table to alter with the new constraint.
 * @param column      the column to alter with the new constraint.
 * @param target      the table to reference.
 * @param primaryKey  the primary key in the target table.
 * @param cascade     {@code true} if updates in primary key should be cascaded.this apply to updates only; delete is always restricted.
 * @return a SQL statement for creating the foreigner key constraint.
 */
public final String createForeignKey(final String schema,final String table,final String column,final String target,final String primaryKey,boolean cascade){
  if (dialect == Dialect.DERBY) {
    cascade=false;
  }
  buffer.setLength(0);
  final String name=buffer.append(table).append('_').append(column).append("String_Node_Str").toString();
  return clear().append("String_Node_Str").appendIdentifier(schema,table).append("String_Node_Str").appendIdentifier(name).append("String_Node_Str").appendIdentifier(column).append("String_Node_Str").appendIdentifier(schema,target).append("String_Node_Str").append(primaryKey).append("String_Node_Str").append(cascade ? "String_Node_Str" : "String_Node_Str").append("String_Node_Str").toString();
}

Fixed version (ground truth):
/** 
 * Returns a SQL statement for creating a foreigner key constraint. The returned statement is of the form:  {@preformat sqlALTER TABLE "schema"."table" ADD CONSTRAINT "table_column_fkey" FOREIGN KEY("column") REFERENCES "schema"."target" (primaryKey) ON UPDATE CASCADE ON DELETE RESTRICT}Note that the primary key is <strong>not</strong> quoted on intent. If quoted are desired, then they must be added explicitly before to call this method.
 * @param schema      the schema for both tables.
 * @param table       the table to alter with the new constraint.
 * @param column      the column to alter with the new constraint.
 * @param target      the table to reference.
 * @param primaryKey  the primary key in the target table.
 * @param cascade     {@code true} if updates in primary key should be cascaded.this apply to updates only; delete is always restricted.
 * @return a SQL statement for creating the foreigner key constraint.
 */
public final String createForeignKey(final String schema,final String table,final String column,final String target,final String primaryKey,boolean cascade){
  if (dialect == Dialect.DERBY) {
    cascade=false;
  }
  buffer.setLength(0);
  final String name=buffer.append(table).append('_').append(column).append("String_Node_Str").toString();
  return clear().append("String_Node_Str").appendIdentifier(schema,table).append("String_Node_Str").appendIdentifier(name).append("String_Node_Str").appendIdentifier(column).append("String_Node_Str").appendIdentifier(schema,target).append("String_Node_Str").appendIdentifier(primaryKey).append("String_Node_Str").append(cascade ? "String_Node_Str" : "String_Node_Str").append("String_Node_Str").toString();
}