Skip to content

Commit d28f45f

Browse files
committed
HHH-17316/HHH-17317/HHH-17318 Remove support for PostgreSQL and EDB 12
1 parent 11ef490 commit d28f45f

File tree

7 files changed

+32
-35
lines changed

7 files changed

+32
-35
lines changed

ci/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ elif [ "$RDBMS" == "mysql" ] || [ "$RDBMS" == "mysql_8_0" ]; then
1212
goal="-Pdb=mysql_ci"
1313
elif [ "$RDBMS" == "mariadb" ] || [ "$RDBMS" == "mariadb_10_4" ]; then
1414
goal="-Pdb=mariadb_ci"
15-
elif [ "$RDBMS" == "postgresql" ] || [ "$RDBMS" == "postgresql_12" ]; then
15+
elif [ "$RDBMS" == "postgresql" ] || [ "$RDBMS" == "postgresql_13" ]; then
1616
goal="-Pdb=pgsql_ci"
17-
elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_12" ]; then
17+
elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_13" ]; then
1818
goal="-Pdb=edb_ci -DdbHost=localhost:5444"
1919
elif [ "$RDBMS" == "oracle" ]; then
2020
goal="-Pdb=oracle_ci"

docker_db.sh

+6-11
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ postgresql() {
154154
postgresql_17
155155
}
156156

157-
postgresql_12() {
158-
$CONTAINER_CLI rm -f postgres || true
159-
$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 ${DB_IMAGE_POSTGRESQL_12:-docker.io/postgis/postgis:12-3.4}
160-
$CONTAINER_CLI exec postgres bash -c '/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && apt install -y postgresql-12-pgvector && psql -U hibernate_orm_test -d hibernate_orm_test -c "create extension vector;"'
161-
}
162-
163157
postgresql_13() {
164158
$CONTAINER_CLI rm -f postgres || true
165159
$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 ${DB_IMAGE_POSTGRESQL_13:-docker.io/postgis/postgis:13-3.1}
@@ -197,11 +191,11 @@ edb() {
197191
edb_17
198192
}
199193

200-
edb_12() {
194+
edb_13() {
201195
$CONTAINER_CLI rm -f edb || true
202196
# We need to build a derived image because the existing image is mainly made for use by a kubernetes operator
203-
(cd edb; $CONTAINER_CLI build -t edb-test:12 -f edb12.Dockerfile .)
204-
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d edb-test:12
197+
(cd edb; $CONTAINER_CLI build -t edb-test:13 -f edb13.Dockerfile .)
198+
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d edb-test:13
205199
}
206200

207201
edb_14() {
@@ -1047,10 +1041,11 @@ if [ -z ${1} ]; then
10471041
echo -e "\tdb2_10_5"
10481042
echo -e "\tdb2_spatial"
10491043
echo -e "\tedb"
1044+
echo -e "\tedb_17"
10501045
echo -e "\tedb_16"
10511046
echo -e "\tedb_15"
10521047
echo -e "\tedb_14"
1053-
echo -e "\tedb_12"
1048+
echo -e "\tedb_13"
10541049
echo -e "\thana"
10551050
echo -e "\tmariadb"
10561051
echo -e "\tmariadb_verylatest"
@@ -1070,11 +1065,11 @@ if [ -z ${1} ]; then
10701065
echo -e "\toracle_23"
10711066
echo -e "\toracle_21"
10721067
echo -e "\tpostgresql"
1068+
echo -e "\tpostgresql_17"
10731069
echo -e "\tpostgresql_16"
10741070
echo -e "\tpostgresql_15"
10751071
echo -e "\tpostgresql_14"
10761072
echo -e "\tpostgresql_13"
1077-
echo -e "\tpostgresql_12"
10781073
echo -e "\tsybase"
10791074
echo -e "\ttidb"
10801075
echo -e "\ttidb_5_4"

edb/edb12.Dockerfile renamed to edb/edb13.Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM quay.io/enterprisedb/edb-postgres-advanced:12.16-3.3-postgis
1+
FROM quay.io/enterprisedb/edb-postgres-advanced:13.20-3.5-postgis
22
USER root
33
# this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
44
RUN chown -R postgres:postgres /var/lib/edb && chmod 777 /var/lib/edb && rm /docker-entrypoint-initdb.d/10_postgis.sh
55

66
USER postgres
77
ENV LANG en_US.utf8
8-
ENV PG_MAJOR 12
9-
ENV PG_VERSION 12
8+
ENV PG_MAJOR 13
9+
ENV PG_VERSION 13
1010
ENV PGPORT 5444
1111
ENV PGDATA /var/lib/edb/as$PG_MAJOR/data/
1212
VOLUME /var/lib/edb/as$PG_MAJOR/data/

hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@
143143
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMillis;
144144

145145
/**
146-
* A {@linkplain Dialect SQL dialect} for PostgreSQL 12 and above.
146+
* A {@linkplain Dialect SQL dialect} for PostgreSQL 13 and above.
147147
* <p>
148148
* Please refer to the
149149
* <a href="https://www.postgresql.org/docs/current/index.html">PostgreSQL documentation</a>.
150150
*
151151
* @author Gavin King
152152
*/
153153
public class PostgreSQLDialect extends Dialect {
154-
protected final static DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 12 );
154+
protected final static DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 13 );
155155

156156
private final UniqueDelegate uniqueDelegate = new CreateTableUniqueDelegate(this);
157157
private final StandardTableExporter postgresqlTableExporter = new StandardTableExporter( this ) {
@@ -645,11 +645,9 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
645645
functionFactory.jsonRemove_postgresql();
646646
functionFactory.jsonReplace_postgresql();
647647
functionFactory.jsonInsert_postgresql();
648-
if ( getVersion().isSameOrAfter( 13 ) ) {
649-
// Requires support for WITH clause in subquery which only 13+ provides
650-
functionFactory.jsonMergepatch_postgresql();
651-
}
652-
functionFactory.jsonArrayAppend_postgresql( getVersion().isSameOrAfter( 13 ) );
648+
// Requires support for WITH clause in subquery which only 13+ provides
649+
functionFactory.jsonMergepatch_postgresql();
650+
functionFactory.jsonArrayAppend_postgresql( true );
653651
functionFactory.jsonArrayInsert_postgresql();
654652

655653
functionFactory.xmlelement();
@@ -1404,7 +1402,7 @@ public boolean supportsFetchClause(FetchClauseType type) {
14041402
return switch (type) {
14051403
case ROWS_ONLY -> true;
14061404
case PERCENT_ONLY, PERCENT_WITH_TIES -> false;
1407-
case ROWS_WITH_TIES -> getVersion().isSameOrAfter(13);
1405+
case ROWS_WITH_TIES -> true;
14081406
};
14091407
}
14101408

hibernate-core/src/main/java/org/hibernate/dialect/function/json/PostgreSQLJsonMergepatchFunction.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,17 @@ public void render(
108108

109109
sqlAppender.appendSql( "select" );
110110
// Use strict aggregation to ensure a SQL null does not end up as JSON null in the result
111-
sqlAppender.appendSql( " jsonb_object_agg_strict(coalesce(" );
111+
sqlAppender.appendSql( " jsonb_object_agg(coalesce(" );
112112
renderColumnList(sqlAppender, "k", arguments.size());
113113
sqlAppender.appendSql( "),coalesce(case when coalesce(" );
114114
renderColumnList(sqlAppender, "k", arguments.size());
115115
sqlAppender.appendSql( ")=r.p[cardinality(r.p)] then r.v end," );
116116
renderColumnList(sqlAppender, "v", arguments.size());
117-
sqlAppender.appendSql( "))" );
117+
sqlAppender.appendSql( ")) filter (where coalesce(case when coalesce(" );
118+
renderColumnList(sqlAppender, "k", arguments.size());
119+
sqlAppender.appendSql( ")=r.p[cardinality(r.p)] then r.v end," );
120+
renderColumnList(sqlAppender, "v", arguments.size());
121+
sqlAppender.appendSql( ") is not null)" );
118122
// The parent path
119123
sqlAppender.appendSql( ",coalesce(" );
120124
renderColumnList(sqlAppender, "p", arguments.size());

hibernate-core/src/test/java/org/hibernate/orm/test/function/array/ArrayTrimTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void testTrimAll(SessionFactoryScope scope) {
8686
}
8787

8888
@Test
89-
@SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 12, matchSubTypes = true, reason = "The PostgreSQL emulation for version < 14 doesn't throw an error")
89+
@SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 13, matchSubTypes = true, reason = "The PostgreSQL emulation for version < 14 doesn't throw an error")
9090
@SkipForDialect(dialectClass = CockroachDialect.class, reason = "The Cockroach emulation doesn't throw an error")
9191
public void testTrimOutOfRange(SessionFactoryScope scope) {
9292
scope.inSession( em -> {

nightly.Jenkinsfile

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ stage('Configure') {
3030
new BuildEnvironment( dbName: 'hsqldb_2_6' ),
3131
new BuildEnvironment( dbName: 'mysql_8_0' ),
3232
new BuildEnvironment( dbName: 'mariadb_10_5' ),
33-
new BuildEnvironment( dbName: 'postgresql_12' ),
34-
new BuildEnvironment( dbName: 'edb_12' ),
33+
new BuildEnvironment( dbName: 'postgresql_13' ),
34+
new BuildEnvironment( dbName: 'edb_13' ),
3535
new BuildEnvironment( dbName: 'db2_10_5', longRunning: true ),
3636
new BuildEnvironment( dbName: 'mssql_2017' ), // Unfortunately there is no SQL Server 2008 image, so we have to test with 2017
3737
// new BuildEnvironment( dbName: 'sybase_16' ), // There only is a Sybase ASE 16 image, so no pint in testing that nightly
@@ -123,17 +123,17 @@ stage('Build') {
123123
sh "./docker_db.sh mariadb_10_5"
124124
state[buildEnv.tag]['containerName'] = "mariadb"
125125
break;
126-
case "postgresql_12":
126+
case "postgresql_13":
127127
// use the postgis image to enable the PGSQL GIS (spatial) extension
128128
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
129-
docker.image('postgis/postgis:12-3.4').pull()
129+
docker.image('postgis/postgis:13-3.1').pull()
130130
}
131-
sh "./docker_db.sh postgresql_12"
131+
sh "./docker_db.sh postgresql_13"
132132
state[buildEnv.tag]['containerName'] = "postgres"
133133
break;
134-
case "edb_12":
135-
docker.image('quay.io/enterprisedb/edb-postgres-advanced:12.16-3.3-postgis').pull()
136-
sh "./docker_db.sh edb_12"
134+
case "edb_13":
135+
docker.image('quay.io/enterprisedb/edb-postgres-advanced:13.20-3.5-postgis').pull()
136+
sh "./docker_db.sh edb_13"
137137
state[buildEnv.tag]['containerName'] = "edb"
138138
break;
139139
case "db2_10_5":

0 commit comments

Comments
 (0)