HHH-15177 - Remove support for PostgreSQL versions older than 11

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2023-08-16 17:32:39 +02:00 committed by Christian Beikov
parent f49535d397
commit 213660001c
10 changed files with 24 additions and 51 deletions

8
Jenkinsfile vendored
View File

@ -174,14 +174,6 @@ stage('Build') {
sh "./docker_db.sh postgresql"
state[buildEnv.tag]['containerName'] = "postgres"
break;
case "postgresql_10":
// use the postgis image to enable the PGSQL GIS (spatial) extension
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('postgis/postgis:10-2.5').pull()
}
sh "./docker_db.sh postgresql_10"
state[buildEnv.tag]['containerName'] = "postgres"
break;
case "edb":
docker.image('quay.io/enterprisedb/edb-postgres-advanced:15.2-3.3-postgis').pull()
sh "./docker_db.sh edb"

View File

@ -121,14 +121,9 @@ postgresql() {
postgresql_15
}
postgresql_9_5() {
postgresql_11() {
$CONTAINER_CLI rm -f postgres || true
$CONTAINER_CLI run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d docker.io/postgis/postgis:9.5-2.5
}
postgresql_10() {
$CONTAINER_CLI rm -f postgres || true
$CONTAINER_CLI run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d docker.io/postgis/postgis:10-2.5
$CONTAINER_CLI run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d docker.io/postgis/postgis:11-3.3
}
postgresql_13() {

View File

@ -84,6 +84,8 @@ public class CommunityDialectSelector implements DialectSelector {
return PostgreSQL94Dialect.class;
case "PostgreSQL95":
return PostgreSQL95Dialect.class;
case "PostgreSQL10":
return PostgreSQL10Dialect.class;
case "RDMSOS2200":
return RDMSOS2200Dialect.class;
case "SAPDB":

View File

@ -4,7 +4,10 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
import org.hibernate.dialect.PostgreSQLDialect;
/**
* An SQL dialect for Postgres 10 and later.

View File

@ -54,6 +54,7 @@ public class CommunityDialectSelectorTest {
testDialectNamingResolution( PostgreSQL93Dialect.class );
testDialectNamingResolution( PostgreSQL94Dialect.class );
testDialectNamingResolution( PostgreSQL95Dialect.class );
testDialectNamingResolution( PostgreSQL10Dialect.class );
testDialectNamingResolution( SAPDBDialect.class );

View File

@ -30,7 +30,6 @@ import org.hibernate.dialect.MySQL8Dialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.Oracle12cDialect;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.PostgreSQL10Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.dialect.SQLServer2008Dialect;
@ -120,9 +119,8 @@ public class DefaultDialectSelector implements DialectSelector {
case "PostgreSQL93":
case "PostgreSQL94":
case "PostgreSQL95":
return findCommunityDialect( name );
case "PostgreSQL10":
return PostgreSQL10Dialect.class;
return findCommunityDialect( name );
case "Spanner":
return SpannerDialect.class;
case "SQLServer":

View File

@ -133,12 +133,12 @@ import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithM
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMillis;
/**
* A {@linkplain Dialect SQL dialect} for PostgreSQL 10 and above.
* A {@linkplain Dialect SQL dialect} for PostgreSQL 11 and above.
*
* @author Gavin King
*/
public class PostgreSQLDialect extends Dialect {
protected final static DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 10 );
protected final static DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 11 );
private final UniqueDelegate uniqueDelegate = new CreateTableUniqueDelegate(this);
@ -1034,9 +1034,7 @@ public class PostgreSQLDialect extends Dialect {
@Override
public CallableStatementSupport getCallableStatementSupport() {
return getVersion().isSameOrAfter( 11 )
? PostgreSQLCallableStatementSupport.INSTANCE
: PostgreSQLCallableStatementSupport.V10_INSTANCE;
return PostgreSQLCallableStatementSupport.INSTANCE;
}
@Override

View File

@ -145,12 +145,12 @@ public class PostgreSQLSqlAstTranslator<T extends JdbcOperation> extends SqlAstT
@Override
public boolean supportsFilterClause() {
return getDialect().getVersion().isSameOrAfter( 9, 4 );
return true;
}
@Override
protected String getForUpdate() {
return getDialect().getVersion().isSameOrAfter( 9, 3 ) ? " for no key update" : " for update";
return " for no key update";
}
@Override
@ -228,29 +228,14 @@ public class PostgreSQLSqlAstTranslator<T extends JdbcOperation> extends SqlAstT
// We render an empty group instead of literals as some DBs don't support grouping by literals
// Note that integer literals, which refer to select item positions, are handled in #visitGroupByClause
if ( expression instanceof Literal ) {
if ( getDialect().getVersion().isSameOrAfter( 9, 5 ) ) {
appendSql( "()" );
}
else {
appendSql( "(select 1" );
appendSql( getFromDualForSelectOnly() );
appendSql( ')' );
}
appendSql( "()" );
}
else if ( expression instanceof Summarization ) {
Summarization summarization = (Summarization) expression;
if ( getDialect().getVersion().isSameOrAfter( 9, 5 ) ) {
appendSql( summarization.getKind().sqlText() );
appendSql( OPEN_PARENTHESIS );
renderCommaSeparated( summarization.getGroupings() );
appendSql( CLOSE_PARENTHESIS );
}
else {
// This could theoretically be emulated by rendering all grouping variations of the query and
// connect them via union all but that's probably pretty inefficient and would have to happen
// on the query spec level
throw new UnsupportedOperationException( "Summarization is not supported by DBMS" );
}
appendSql( summarization.getKind().sqlText() );
appendSql( OPEN_PARENTHESIS );
renderCommaSeparated( summarization.getGroupings() );
appendSql( CLOSE_PARENTHESIS );
}
else {
expression.accept( this );

View File

@ -48,7 +48,6 @@ public class DefaultDialectSelectorTest {
testDialectNamingResolution( PostgreSQLDialect.class );
testDialectNamingResolution( PostgresPlusDialect.class );
testDialectNamingResolution( PostgreSQL10Dialect.class );
testDialectNamingResolution( SQLServerDialect.class );
testDialectNamingResolution( SQLServer2008Dialect.class );

View File

@ -32,7 +32,7 @@ stage('Configure') {
new BuildEnvironment( dbName: 'derby_10_14' ),
new BuildEnvironment( dbName: 'mysql_5_7' ),
new BuildEnvironment( dbName: 'mariadb_10_3' ),
new BuildEnvironment( dbName: 'postgresql_10' ),
new BuildEnvironment( dbName: 'postgresql_11' ),
new BuildEnvironment( dbName: 'edb_10' ),
new BuildEnvironment( dbName: 'oracle_11_2' ),
new BuildEnvironment( dbName: 'db2_10_5', longRunning: true ),
@ -158,12 +158,12 @@ stage('Build') {
sh "./docker_db.sh postgresql"
state[buildEnv.tag]['containerName'] = "postgres"
break;
case "postgresql_10":
case "postgresql_11":
// use the postgis image to enable the PGSQL GIS (spatial) extension
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('postgis/postgis:10-2.5').pull()
docker.image('postgis/postgis:11-3.3').pull()
}
sh "./docker_db.sh postgresql_10"
sh "./docker_db.sh postgresql_11"
state[buildEnv.tag]['containerName'] = "postgres"
break;
case "edb":