public static String quoteIdentifier ( String identifier , boolean isH2DataBase ) { if ( ( isH2DataBase && ( Constants . H2_RESERVED_WORDS . contains ( identifier . toUpperCase ( ) ) || ! H2_SPECIAL_NAME_PATTERN . matcher ( identifier ) . find ( ) ) ) || ( ! isH2DataBase && ( Constants . POSTGIS_RESERVED_WORDS . contains ( identifier . toUpperCase ( ) ) || ! POSTGRE_SPECIAL_NAME_PATTERN . matcher ( identifier ) . find ( ) ) ) ) { return quoteIdentifier ( identifier ) ; } else { return identifier ; } }
Quote identifier only if necessary . Require database knowledge .