Skip to content

Commit

Permalink
HHH-16454 PostgreSQL ILIKE Keyword is considered a column name when d…
Browse files Browse the repository at this point in the history
…educing alias injection points
  • Loading branch information
dreab8 authored and mbladel committed Feb 8, 2024
1 parent a2d3315 commit 6057d99
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -940,4 +940,19 @@ public String rowId(String rowId) {
public int rowIdSqlType() {
return BIGINT;
}

@Override
public String getCaseInsensitiveLike() {
if ( getVersion().isSameOrAfter( 1, 4, 194 ) ) {
return "ilike";
}
else {
return super.getCaseInsensitiveLike();
}
}

@Override
public boolean supportsCaseInsensitiveLike() {
return getVersion().isSameOrAfter( 1, 4, 194 );
}
}
11 changes: 11 additions & 0 deletions hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java
Original file line number Diff line number Diff line change
Expand Up @@ -935,4 +935,15 @@ public String createMarker(int position, JdbcType jdbcType) {
return "?" + position;
}
}

@Override
public String getCaseInsensitiveLike() {
return "ilike";
}

@Override
public boolean supportsCaseInsensitiveLike(){
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public PostgreSQLDialect() {

public PostgreSQLDialect(DialectResolutionInfo info) {
this( info, PostgreSQLDriverKind.determineKind( info ) );
registerKeywords( info );
}

public PostgreSQLDialect(DatabaseVersion version) {
Expand Down

0 comments on commit 6057d99

Please sign in to comment.