Buggy code:
public class DBDatabaseDriverPostgreSQL extends DBDatabaseDriver { private static final long serialVersionUID = 1L ; private static final Logger log = LoggerFactory . getLogger ( DBDatabaseDriverPostgreSQL . class ) ; private static final String CREATE_REVERSE_FUNCTION = "CREATE<seq2seq4repair_space>OR<seq2seq4repair_space>REPLACE<seq2seq4repair_space>FUNCTION<seq2seq4repair_space>reverse(TEXT)<seq2seq4repair_space>RETURNS<seq2seq4repair_space>TEXT<seq2seq4repair_space>AS<seq2seq4repair_space>$$\n" + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "DECLARE\n" + "<seq2seq4repair_space>original<seq2seq4repair_space>ALIAS<seq2seq4repair_space>FOR<seq2seq4repair_space>$1;\n" ) + "<seq2seq4repair_space>reversed<seq2seq4repair_space>TEXT<seq2seq4repair_space>:=<seq2seq4repair_space>\'\';\n" ) + "<seq2seq4repair_space>onechar<seq2seq4repair_space>VARCHAR;\n" ) + "<seq2seq4repair_space>mypos<seq2seq4repair_space>INTEGER;\n" ) + "BEGIN\n" ) + "<seq2seq4repair_space>SELECT<seq2seq4repair_space>LENGTH(original)<seq2seq4repair_space>INTO<seq2seq4repair_space>mypos;\n" ) + "<seq2seq4repair_space>LOOP\n" ) + "<seq2seq4repair_space>EXIT<seq2seq4repair_space>WHEN<seq2seq4repair_space>mypos<seq2seq4repair_space><<seq2seq4repair_space>1;\n" ) + "<seq2seq4repair_space>SELECT<seq2seq4repair_space>substring(original<seq2seq4repair_space>FROM<seq2seq4repair_space>mypos<seq2seq4repair_space>FOR<seq2seq4repair_space>1)<seq2seq4repair_space>INTO<seq2seq4repair_space>onechar;\n" ) + "<seq2seq4repair_space>reversed<seq2seq4repair_space>:=<seq2seq4repair_space>reversed<seq2seq4repair_space>||<seq2seq4repair_space>onechar;\n" ) + "<seq2seq4repair_space>mypos<seq2seq4repair_space>:=<seq2seq4repair_space>mypos<seq2seq4repair_space>-1;\n" ) + "<seq2seq4repair_space>END<seq2seq4repair_space>LOOP;\n" ) + "<seq2seq4repair_space>RETURN<seq2seq4repair_space>reversed;\n" ) + "END\n" ) + "$$<seq2seq4repair_space>LANGUAGE<seq2seq4repair_space>plpgsql<seq2seq4repair_space>IMMUTABLE<seq2seq4repair_space>RETURNS<seq2seq4repair_space>NULL<seq2seq4repair_space>ON<seq2seq4repair_space>NULL<seq2seq4repair_space>INPUT" ) ; public static class DBCommandPostreSQL extends DBCommand { private static final long serialVersionUID = 1L ; protected int limit = - 1 ; protected int skip = - 1 ; public DBCommandPostreSQL ( DBDatabase db ) { } @ Override public void limitRows ( int numRows ) { } @ Override public void skipRows ( int numRows ) { } @ Override public void clearLimit ( ) { } @ Override public void getSelect ( StringBuilder buf ) { } } private String databaseName ; private DBDDLGenerator < ? > ddlGenerator = null ; public DBDatabaseDriverPostgreSQL ( ) { } private void addReservedKeyWord ( final String keyWord ) { } private void setReservedKeywords ( ) { } public String getDatabaseName ( ) { } public void setDatabaseName ( String databaseName ) { } public void createReverseFunction ( Connection conn ) { } @ Override public DBCommand createCommand ( DBDatabase db ) { } @ Override public boolean isSupported ( DBDriverFeature type ) { } @ Override public String getSQLPhrase ( int phrase ) { switch ( phrase ) { case SQL_NULL_VALUE : return "null" ; case SQL_PARAMETER : return "<seq2seq4repair_space>?<seq2seq4repair_space>" ; case SQL_RENAME_TABLE : return "<seq2seq4repair_space>" ; case SQL_RENAME_COLUMN : return "<seq2seq4repair_space>AS<seq2seq4repair_space>" ; case SQL_DATABASE_LINK : return "@" ; case SQL_QUOTES_OPEN : return "\"" ; case SQL_QUOTES_CLOSE : return "\"" ; case SQL_CONCAT_EXPR : return "?<seq2seq4repair_space>||<seq2seq4repair_space>{0}" ; case SQL_BOOLEAN_TRUE : return "TRUE" ; case SQL_BOOLEAN_FALSE : return "FALSE" ; case SQL_CURRENT_DATE : return "CURRENT_DATE()" ; case SQL_DATE_PATTERN : return "yyyy-MM-dd" ; case SQL_DATE_TEMPLATE : return "'{0}'" ; case SQL_CURRENT_DATETIME : return "NOW()" ; case SQL_DATETIME_PATTERN : return "yyyy-MM-dd<seq2seq4repair_space>HH:mm:ss" ; case SQL_DATETIME_TEMPLATE : return "'{0}'" ; case SQL_FUNC_COALESCE : return "coalesce(?,<seq2seq4repair_space>{0})" ; case SQL_FUNC_SUBSTRING : return "substring(?,<seq2seq4repair_space>{0})" ; case SQL_FUNC_SUBSTRINGEX : return "substring(?,<seq2seq4repair_space>{0},<seq2seq4repair_space>{1})" ; case SQL_FUNC_REPLACE : return "replace(?,<seq2seq4repair_space>{0},<seq2seq4repair_space>{1})" ; case SQL_FUNC_REVERSE : return "reverse(?)" ; case SQL_FUNC_STRINDEX : return "strpos(?,<seq2seq4repair_space>{0})" ; case SQL_FUNC_STRINDEXFROM : return "strindexfrom_not_available_in_pgsql({0},<seq2seq4repair_space>?,<seq2seq4repair_space>{1})" ; case SQL_FUNC_LENGTH : return "length(?)" ; case SQL_FUNC_UPPER : return "upper(?)" ; case SQL_FUNC_LOWER : <START_BUG> return "lcase(?)" ; <END_BUG> case SQL_FUNC_TRIM : return "trim(?)" ; case SQL_FUNC_LTRIM : return "ltrim(?)" ; case SQL_FUNC_RTRIM : return "rtrim(?)" ; case SQL_FUNC_ESCAPE : return "?<seq2seq4repair_space>escape<seq2seq4repair_space>'{0}'" ; case SQL_FUNC_ABS : return "abs(?)" ; case SQL_FUNC_ROUND : return "round(?,{0})" ; case SQL_FUNC_TRUNC : return "truncate(?,{0})" ; case SQL_FUNC_CEILING : return "ceiling(?)" ; case SQL_FUNC_FLOOR : return "floor(?)" ; case SQL_FUNC_MODULO : return "mod(?,{0})" ; case SQL_FUNC_DAY : return "day(?)" ; case SQL_FUNC_MONTH : return "month(?)" ; case SQL_FUNC_YEAR : return "year(?)" ; case SQL_FUNC_SUM : return "sum(?)" ; case SQL_FUNC_MAX : return "max(?)" ; case SQL_FUNC_MIN : return "min(?)" ; case SQL_FUNC_AVG : return "avg(?)" ; case SQL_FUNC_DECODE : return "case<seq2seq4repair_space>?<seq2seq4repair_space>{0}<seq2seq4repair_space>end" ; case SQL_FUNC_DECODE_SEP : return "<seq2seq4repair_space>" ; case SQL_FUNC_DECODE_PART : return "when<seq2seq4repair_space>{0}<seq2seq4repair_space>then<seq2seq4repair_space>{1}" ; case SQL_FUNC_DECODE_ELSE : return "else<seq2seq4repair_space>{0}" ; default : DBDatabaseDriverPostgreSQL . log . error ( ( ( "SQL<seq2seq4repair_space>phrase<seq2seq4repair_space>" + ( String . valueOf ( phrase ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>defined!" ) ) ; return "?" ; } } @ Override public String getConvertPhrase ( DataType destType , DataType srcType , Object format ) { } @ Override public Object getNextSequenceValue ( DBDatabase db , String seqName , int minValue , Connection conn ) { } @ Override public Timestamp getUpdateTimestamp ( Connection conn ) { } @ Override public void getDDLScript ( DBCmdType type , DBObject dbo , DBSQLScript script ) { } @ Override public Object getResultValue ( ResultSet rset , int columnIndex , DataType dataType ) throws SQLException { } }

Fix:
return "lower(?)" ;