Skip to content

Commit a14f46a

Browse files
committed
Update PostgreSQL testing to version 18
1 parent e0f889d commit a14f46a

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

docker_db.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ mariadb_setup() {
219219
}
220220

221221
postgresql() {
222-
postgresql_17
222+
postgresql_18
223223
}
224224

225225
postgresql_13() {
@@ -262,6 +262,14 @@ postgresql_17() {
262262
postgresql_setup
263263
}
264264

265+
postgresql_18() {
266+
$CONTAINER_CLI rm -f postgres || true
267+
$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 --tmpfs /var/lib/postgresql -d ${DB_IMAGE_POSTGRESQL_17:-docker.io/postgis/postgis:18-3.6} \
268+
-c fsync=off -c synchronous_commit=off -c full_page_writes=off -c shared_buffers=256MB -c maintenance_work_mem=256MB -c max_wal_size=1GB -c checkpoint_timeout=1d
269+
$CONTAINER_CLI exec postgres bash -c '/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && apt install -y postgresql-18-pgvector'
270+
postgresql_setup
271+
}
272+
265273
postgresql_setup() {
266274
databases=()
267275
for n in $(seq 1 $DB_COUNT)

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/PostgreSQLLegacyDialect.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
613613
functionFactory.initcap();
614614
functionFactory.substr();
615615
functionFactory.substring_substr();
616+
functionFactory.reverse();
616617
//also natively supports ANSI-style substring()
617618
functionFactory.translate();
618619
functionFactory.toCharNumberDateTimestamp();
@@ -917,6 +918,13 @@ public boolean supportsCaseInsensitiveLike() {
917918
return true;
918919
}
919920

921+
@Override
922+
public String generatedAs(String generatedAs) {
923+
return getVersion().isSameOrAfter( 18 )
924+
? " generated always as (" + generatedAs + ")"
925+
: super.generatedAs( generatedAs );
926+
}
927+
920928
@Override
921929
public GenerationType getNativeValueGenerationStrategy() {
922930
return GenerationType.SEQUENCE;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
574574
functionFactory.substr();
575575
functionFactory.substring_substr();
576576
//also natively supports ANSI-style substring()
577+
functionFactory.reverse();
577578
functionFactory.translate();
578579
functionFactory.toCharNumberDateTimestamp();
579580
functionFactory.concat_pipeOperator( "convert_from(lo_get(?1),pg_client_encoding())" );
@@ -897,6 +898,13 @@ public boolean supportsCaseInsensitiveLike() {
897898
return true;
898899
}
899900

901+
@Override
902+
public String generatedAs(String generatedAs) {
903+
return getVersion().isSameOrAfter( 18 )
904+
? " generated always as (" + generatedAs + ")"
905+
: super.generatedAs( generatedAs );
906+
}
907+
900908
@Override
901909
public GenerationType getNativeValueGenerationStrategy() {
902910
return GenerationType.SEQUENCE;

0 commit comments

Comments
 (0)