HHH-15615 Add EDB PostgreSQL Advanced to test matrix and fix issues

This commit is contained in:
Christian Beikov 2022-10-19 19:25:16 +02:00
parent 940f15b63e
commit ee7c2ee041
15 changed files with 431 additions and 13 deletions

View File

@ -43,6 +43,7 @@ jobs:
- rdbms: mariadb - rdbms: mariadb
- rdbms: postgresql - rdbms: postgresql
- rdbms: postgresql_14 - rdbms: postgresql_14
- rdbms: edb
- rdbms: oracle - rdbms: oracle
- rdbms: db2 - rdbms: db2
- rdbms: mssql - rdbms: mssql

8
Jenkinsfile vendored
View File

@ -34,6 +34,7 @@ stage('Configure') {
// new BuildEnvironment( dbName: 'mariadb' ), // new BuildEnvironment( dbName: 'mariadb' ),
// new BuildEnvironment( dbName: 'postgresql' ), // new BuildEnvironment( dbName: 'postgresql' ),
// new BuildEnvironment( dbName: 'postgresql_14' ), // new BuildEnvironment( dbName: 'postgresql_14' ),
// new BuildEnvironment( dbName: 'edb' ),
// new BuildEnvironment( dbName: 'oracle' ), // new BuildEnvironment( dbName: 'oracle' ),
// new BuildEnvironment( dbName: 'db2' ), // new BuildEnvironment( dbName: 'db2' ),
// new BuildEnvironment( dbName: 'mssql' ), // new BuildEnvironment( dbName: 'mssql' ),
@ -194,12 +195,7 @@ stage('Build') {
state[buildEnv.tag]['containerName'] = "sybase" state[buildEnv.tag]['containerName'] = "sybase"
break; break;
case "edb": case "edb":
docker.withRegistry('https://containers.enterprisedb.com', 'hibernateci.containers.enterprisedb.com') { docker.image('quay.io/enterprisedb/edb-postgres-advanced:10.22').pull()
// withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'hibernateci.containers.enterprisedb.com',
// usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
// sh 'docker login -u "$USERNAME" -p "$PASSWORD" https://containers.enterprisedb.com'
docker.image('containers.enterprisedb.com/edb/edb-as-lite:v11').pull()
}
sh "./docker_db.sh edb" sh "./docker_db.sh edb"
state[buildEnv.tag]['containerName'] = "edb" state[buildEnv.tag]['containerName'] = "edb"
break; break;

View File

@ -7,7 +7,7 @@ if [ "$RDBMS" == "h2" ]; then
elif [ "$RDBMS" == "derby" ]; then elif [ "$RDBMS" == "derby" ]; then
goal="-Pdb=derby" goal="-Pdb=derby"
elif [ "$RDBMS" == "edb" ]; then elif [ "$RDBMS" == "edb" ]; then
goal="-Pdb=edb_ci" goal="-Pdb=edb_ci -DdbHost=localhost:5444"
elif [ "$RDBMS" == "hsqldb" ]; then elif [ "$RDBMS" == "hsqldb" ]; then
goal="-Pdb=hsqldb" goal="-Pdb=hsqldb"
elif [ "$RDBMS" == "mysql8" ]; then elif [ "$RDBMS" == "mysql8" ]; then

View File

@ -12,6 +12,8 @@ elif [ "$RDBMS" == 'postgresql' ]; then
bash $DIR/../docker_db.sh postgresql bash $DIR/../docker_db.sh postgresql
elif [ "$RDBMS" == 'postgresql_14' ]; then elif [ "$RDBMS" == 'postgresql_14' ]; then
bash $DIR/../docker_db.sh postgresql_14 bash $DIR/../docker_db.sh postgresql_14
elif [ "$RDBMS" == 'edb' ]; then
bash $DIR/../docker_db.sh edb
elif [ "$RDBMS" == 'db2' ]; then elif [ "$RDBMS" == 'db2' ]; then
bash $DIR/../docker_db.sh db2 bash $DIR/../docker_db.sh db2
elif [ "$RDBMS" == 'oracle' ]; then elif [ "$RDBMS" == 'oracle' ]; then

View File

@ -115,9 +115,15 @@ postgresql_14() {
} }
edb() { edb() {
#$CONTAINER_CLI login containers.enterprisedb.com edb_10
}
edb_10() {
$CONTAINER_CLI rm -f edb || true $CONTAINER_CLI rm -f edb || true
$CONTAINER_CLI run --name edb -e ACCEPT_EULA=Yes -e DATABASE_USER=hibernate_orm_test -e DATABASE_USER_PASSWORD=hibernate_orm_test -e ENTERPRISEDB_PASSWORD=hibernate_orm_test -e DATABASE_NAME=hibernate_orm_test -e PGPORT=5433 -p 5433:5433 --mount type=tmpfs,destination=/edbvolume -d containers.enterprisedb.com/edb/edb-as-lite:v11 # The version of the base image can be seen and updated in ./edb/Dockerfile
# We need to build a derived image because the existing image is mainly made for use by a kubernetes operator
(cd edb; $CONTAINER_CLI build -t edb-test:latest .)
$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:latest
} }
db2() { db2() {

52
edb/Dockerfile Normal file
View File

@ -0,0 +1,52 @@
FROM quay.io/enterprisedb/edb-postgres-advanced:10.22
USER root
RUN chown -R postgres:postgres /var/lib/edb && chmod 777 /var/lib/edb && mkdir /docker-entrypoint-initdb.d
#FROM quay.io/enterprisedb/edb-postgres-advanced:11.17-3.2-postgis
#USER root
# this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
#RUN chown -R postgres:postgres /var/lib/edb && chmod 777 /var/lib/edb && rm /docker-entrypoint-initdb.d/10_postgis.sh
USER postgres
ENV LANG en_US.utf8
ENV PG_MAJOR 10
ENV PG_VERSION 10
ENV PGPORT 5444
ENV PGDATA /var/lib/edb/as$PG_MAJOR/data/
VOLUME /var/lib/edb/as$PG_MAJOR/data/
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
# We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL
# calls "Fast Shutdown mode" wherein new connections are disallowed and any
# in-progress transactions are aborted, allowing PostgreSQL to stop cleanly and
# flush tables to disk, which is the best compromise available to avoid data
# corruption.
#
# Users who know their applications do not keep open long-lived idle connections
# may way to use a value of SIGTERM instead, which corresponds to "Smart
# Shutdown mode" in which any existing sessions are allowed to finish and the
# server stops when all sessions are terminated.
#
# See https://www.postgresql.org/docs/12/server-shutdown.html for more details
# about available PostgreSQL server shutdown signals.
#
# See also https://www.postgresql.org/docs/12/server-start.html for further
# justification of this as the default value, namely that the example (and
# shipped) systemd service files use the "Fast Shutdown mode" for service
# termination.
#
STOPSIGNAL SIGINT
#
# An additional setting that is recommended for all users regardless of this
# value is the runtime "--stop-timeout" (or your orchestrator/runtime's
# equivalent) for controlling how long to wait between sending the defined
# STOPSIGNAL and sending SIGKILL (which is likely to cause data corruption).
#
# The default in most runtimes (such as Docker) is 10 seconds, and the
# documentation at https://www.postgresql.org/docs/12/server-start.html notes
# that even 90 seconds may not be long enough in many instances.
EXPOSE 5444
CMD ["postgres"]

348
edb/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,348 @@
#!/usr/bin/env bash
set -Eeo pipefail
# TODO swap to -Eeuo pipefail above (after handling all potentially-unset variables)
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
# check to see if this file is being run or sourced from another script
_is_sourced() {
# https://unix.stackexchange.com/a/215279
[ "${#FUNCNAME[@]}" -ge 2 ] \
&& [ "${FUNCNAME[0]}" = '_is_sourced' ] \
&& [ "${FUNCNAME[1]}" = 'source' ]
}
# used to create initial postgres directories and if run as root, ensure ownership to the "postgres" user
docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
# ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
chmod 775 /var/run/postgresql || :
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
if [ -n "${POSTGRES_INITDB_WALDIR:-}" ]; then
mkdir -p "$POSTGRES_INITDB_WALDIR"
if [ "$user" = '0' ]; then
find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' +
fi
chmod 700 "$POSTGRES_INITDB_WALDIR"
fi
# allow the container to be started with `--user`
if [ "$user" = '0' ]; then
find "$PGDATA" \! -user postgres -exec chown postgres '{}' +
find /var/run/postgresql \! -user postgres -exec chown postgres '{}' +
fi
}
# initialize empty PGDATA directory with new database via 'initdb'
# arguments to `initdb` can be passed via POSTGRES_INITDB_ARGS or as arguments to this function
# `initdb` automatically creates the "postgres", "template0", and "template1" dbnames
# this is also where the database user is created, specified by `POSTGRES_USER` env
docker_init_database_dir() {
# "initdb" is particular about the current user existing in "/etc/passwd", so we use "nss_wrapper" to fake that if necessary
# see https://github.com/docker-library/postgres/pull/253, https://github.com/docker-library/postgres/issues/359, https://cwrap.org/nss_wrapper.html
local uid; uid="$(id -u)"
if ! getent passwd "$uid" &> /dev/null; then
# see if we can find a suitable "libnss_wrapper.so" (https://salsa.debian.org/sssd-team/nss-wrapper/-/commit/b9925a653a54e24d09d9b498a2d913729f7abb15)
local wrapper
for wrapper in {/usr,}/lib{/*,}/libnss_wrapper.so; do
if [ -s "$wrapper" ]; then
NSS_WRAPPER_PASSWD="$(mktemp)"
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
break
fi
done
fi
if [ -n "${POSTGRES_INITDB_WALDIR:-}" ]; then
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP"
unset LD_PRELOAD NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
fi
}
# print large warning if POSTGRES_PASSWORD is long
# error if both POSTGRES_PASSWORD is empty and POSTGRES_HOST_AUTH_METHOD is not 'trust'
# print large warning if POSTGRES_HOST_AUTH_METHOD is set to 'trust'
# assumes database is not set up, ie: [ -z "$DATABASE_ALREADY_EXISTS" ]
docker_verify_minimum_env() {
# check password first so we can output the warning before postgres
# messes it up
if [ "${#POSTGRES_PASSWORD}" -ge 100 ]; then
cat >&2 <<-'EOWARN'
WARNING: The supplied POSTGRES_PASSWORD is 100+ characters.
This will not work if used via PGPASSWORD with "psql".
https://www.postgresql.org/message-id/flat/E1Rqxp2-0004Qt-PL%40wrigleys.postgresql.org (BUG #6412)
https://github.com/docker-library/postgres/issues/507
EOWARN
fi
if [ -z "$POSTGRES_PASSWORD" ] && [ 'trust' != "$POSTGRES_HOST_AUTH_METHOD" ]; then
# The - option suppresses leading tabs but *not* spaces. :)
cat >&2 <<-'EOE'
Error: Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD to a non-empty value for the
superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
connections without a password. This is *not* recommended.
See PostgreSQL documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html
EOE
exit 1
fi
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
cat >&2 <<-'EOWARN'
********************************************************************************
WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow
anyone with access to the Postgres port to access your database without
a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html
In Docker's default configuration, this is effectively any other
container on the same system.
It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace
it with "-e POSTGRES_PASSWORD=password" instead to set a password in
"docker run".
********************************************************************************
EOWARN
fi
}
# usage: docker_process_init_files [file [file [...]]]
# ie: docker_process_init_files /always-initdb.d/*
# process initializer files, based on file extensions and permissions
docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
echo
local f
for f; do
case "$f" in
*.sh)
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
echo "$0: running $f"
"$f"
else
echo "$0: sourcing $f"
. "$f"
fi
;;
*.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
*.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
*.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
*) echo "$0: ignoring $f" ;;
esac
echo
done
}
# Execute sql script, passed via stdin (or -f flag of pqsl)
# usage: docker_process_sql [psql-cli-args]
# ie: docker_process_sql --dbname=mydb <<<'INSERT ...'
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --no-password --no-psqlrc )
if [ -n "$POSTGRES_DB" ]; then
query_runner+=( --dbname "$POSTGRES_DB" )
fi
PGHOST= PGHOSTADDR= "${query_runner[@]}" "$@"
}
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
local dbAlreadyExists
dbAlreadyExists="$(
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
SELECT 1 FROM pg_database WHERE datname = :'db' ;
EOSQL
)"
if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
echo
fi
}
# Loads various settings that are used elsewhere in the script
# This should be called before any other functions
docker_setup_env() {
file_env 'POSTGRES_PASSWORD'
file_env 'POSTGRES_USER' 'postgres'
file_env 'POSTGRES_DB' "$POSTGRES_USER"
file_env 'POSTGRES_INITDB_ARGS'
: "${POSTGRES_HOST_AUTH_METHOD:=}"
declare -g DATABASE_ALREADY_EXISTS
# look specifically for PG_VERSION, as it is expected in the DB dir
if [ -s "$PGDATA/PG_VERSION" ]; then
DATABASE_ALREADY_EXISTS='true'
fi
}
# append POSTGRES_HOST_AUTH_METHOD to pg_hba.conf for "host" connections
# all arguments will be passed along as arguments to `postgres` for getting the value of 'password_encryption'
pg_setup_hba_conf() {
# default authentication method is md5 on versions before 14
# https://www.postgresql.org/about/news/postgresql-14-released-2318/
if [ "$1" = 'postgres' ]; then
shift
fi
local auth
# check the default/configured encryption and use that as the auth method
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
echo
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
echo '# warning trust is enabled for all connections'
echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
fi
echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
# start socket-only postgresql server for setting up or running scripts
# all arguments will be passed along as arguments to `postgres` (via pg_ctl)
docker_temp_server_start() {
if [ "$1" = 'postgres' ]; then
shift
fi
# internal start of server in order to allow setup using psql client
# does not listen on external TCP/IP and waits until start finishes
set -- "$@" -c listen_addresses='' -p "${PGPORT:-5432}"
PGUSER="${PGUSER:-$POSTGRES_USER}" \
pg_ctl -D "$PGDATA" \
-o "$(printf '%q ' "$@")" \
-w start
}
# stop postgresql server after done setting up user and running scripts
docker_temp_server_stop() {
PGUSER="${PGUSER:-postgres}" \
pg_ctl -D "$PGDATA" -m fast -w stop
}
# check arguments for an option that would cause postgres to stop
# return true if there is one
_pg_want_help() {
local arg
for arg; do
case "$arg" in
# postgres --help | grep 'then exit'
# leaving out -C on purpose since it always fails and is unhelpful:
# postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
-'?'|--help|--describe-config|-V|--version)
return 0
;;
esac
done
return 1
}
_main() {
# if first arg looks like a flag, assume we want to run postgres server
if [ "${1:0:1}" = '-' ]; then
set -- postgres "$@"
fi
if [ "$1" = 'postgres' ] && ! _pg_want_help "$@"; then
docker_setup_env
# setup data directories and permissions (when run as root)
docker_create_db_directories
if [ "$(id -u)" = '0' ]; then
# then restart script as postgres user
exec gosu postgres "$BASH_SOURCE" "$@"
fi
# only run initialization on an empty data directory
if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
docker_verify_minimum_env
# check dir permissions to reduce likelihood of half-initialized database
ls /docker-entrypoint-initdb.d/ > /dev/null
docker_init_database_dir
pg_setup_hba_conf "$@"
# PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless
# e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS
export PGPASSWORD="${PGPASSWORD:-$POSTGRES_PASSWORD}"
docker_temp_server_start "$@"
echo "setup db"
docker_setup_db
echo "init files"
docker_process_init_files /docker-entrypoint-initdb.d/*
docker_temp_server_stop
unset PGPASSWORD
echo
echo 'PostgreSQL init process complete; ready for start up.'
echo
else
echo
echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
echo
fi
fi
exec "$@"
}
if ! _is_sourced; then
_main "$@"
fi

View File

@ -10,7 +10,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
// build a map of the database settings to use. // build a map of the database settings to use.
ext { ext {
db = project.hasProperty('db') ? project.getProperty('db') : 'h2' db = project.hasProperty('db') ? project.getProperty('db') : 'h2'
def dbHost = System.getProperty( 'dbHost', 'localhost' ) dbHost = System.getProperty( 'dbHost', 'localhost' )
dbBundle = [ dbBundle = [
h2 : [ h2 : [
'db.dialect' : 'org.hibernate.dialect.H2Dialect', 'db.dialect' : 'org.hibernate.dialect.H2Dialect',
@ -353,5 +353,6 @@ ext {
def processTestResourcesTask = project.tasks.findByName( 'processTestResources' ) def processTestResourcesTask = project.tasks.findByName( 'processTestResources' )
if ( processTestResourcesTask != null ) { if ( processTestResourcesTask != null ) {
processTestResourcesTask.inputs.property( 'db', db ) processTestResourcesTask.inputs.property( 'db', db )
processTestResourcesTask.inputs.property( 'dbHost', dbHost )
processTestResourcesTask.filter( ReplaceTokens, tokens: dbBundle[db] ) processTestResourcesTask.filter( ReplaceTokens, tokens: dbBundle[db] )
} }

View File

@ -313,6 +313,7 @@ sourceSets {
processTestResources { processTestResources {
duplicatesStrategy DuplicatesStrategy.INCLUDE duplicatesStrategy DuplicatesStrategy.INCLUDE
inputs.property( "db", db ) inputs.property( "db", db )
inputs.property( "dbHost", dbHost )
doLast { doLast {
copy { copy {
from( sourceSets.test.java.srcDirs ) { from( sourceSets.test.java.srcDirs ) {

View File

@ -134,6 +134,7 @@ xjc {
task copyBundleResourcesXml (type: Copy) { task copyBundleResourcesXml (type: Copy) {
inputs.property( "db", db ) inputs.property( "db", db )
inputs.property( "dbHost", dbHost )
ext { ext {
bundlesTargetDir = file( "${buildDir}/bundles" ) bundlesTargetDir = file( "${buildDir}/bundles" )
// Escape // Escape

View File

@ -16,6 +16,7 @@ import java.util.Locale;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.OracleDialect; import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.jdbc.Work; import org.hibernate.jdbc.Work;
import org.hibernate.type.descriptor.JdbcTypeNameMapper; import org.hibernate.type.descriptor.JdbcTypeNameMapper;
@ -56,7 +57,7 @@ public class BasicOperationsTest {
public static class OracleDialectChecker implements DialectFeatureCheck { public static class OracleDialectChecker implements DialectFeatureCheck {
@Override @Override
public boolean apply(Dialect dialect) { public boolean apply(Dialect dialect) {
return !( dialect instanceof OracleDialect ); return !( dialect instanceof OracleDialect ) && !( dialect instanceof PostgresPlusDialect );
} }
} }

View File

@ -27,6 +27,7 @@ import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.MariaDBDialect; import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect; import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.OracleDialect; import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.dialect.SQLServerDialect; import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseDialect; import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.TiDBDialect; import org.hibernate.dialect.TiDBDialect;
@ -81,6 +82,7 @@ public class FilterParameterTests {
@SkipForDialect(dialectClass = SybaseDialect.class, matchSubTypes = true, reason = "Sybase silently converts a boolean to string types") @SkipForDialect(dialectClass = SybaseDialect.class, matchSubTypes = true, reason = "Sybase silently converts a boolean to string types")
@SkipForDialect(dialectClass = AbstractHANADialect.class, matchSubTypes = true, reason = "HANA silently converts a boolean to string types") @SkipForDialect(dialectClass = AbstractHANADialect.class, matchSubTypes = true, reason = "HANA silently converts a boolean to string types")
@SkipForDialect(dialectClass = CockroachDialect.class, matchSubTypes = true, reason = "Cockroach silently converts a boolean to string types") @SkipForDialect(dialectClass = CockroachDialect.class, matchSubTypes = true, reason = "Cockroach silently converts a boolean to string types")
@SkipForDialect(dialectClass = PostgresPlusDialect.class, reason = "PostgresPlus silently converts a boolean to string types")
public void testYesNoMismatch(SessionFactoryScope scope) { public void testYesNoMismatch(SessionFactoryScope scope) {
scope.inTransaction( (session) -> { scope.inTransaction( (session) -> {
final EntityOne loaded = session.byId( EntityOne.class ).load( 1 ); final EntityOne loaded = session.byId( EntityOne.class ).load( 1 );
@ -150,6 +152,7 @@ public class FilterParameterTests {
@SkipForDialect(dialectClass = MySQLDialect.class, reason = "MySQL silently converts strings to integral types") @SkipForDialect(dialectClass = MySQLDialect.class, reason = "MySQL silently converts strings to integral types")
@SkipForDialect(dialectClass = MariaDBDialect.class, reason = "MariaDB silently converts strings to integral types") @SkipForDialect(dialectClass = MariaDBDialect.class, reason = "MariaDB silently converts strings to integral types")
@SkipForDialect(dialectClass = TiDBDialect.class, reason = "TiDB silently converts strings to integral types") @SkipForDialect(dialectClass = TiDBDialect.class, reason = "TiDB silently converts strings to integral types")
@SkipForDialect(dialectClass = PostgresPlusDialect.class, reason = "PostgresPlus silently converts strings to integral types")
public void testMismatch(SessionFactoryScope scope) { public void testMismatch(SessionFactoryScope scope) {
scope.inTransaction( (session) -> { scope.inTransaction( (session) -> {
final EntityThree loaded = session.byId( EntityThree.class ).load( 1 ); final EntityThree loaded = session.byId( EntityThree.class ).load( 1 );

View File

@ -35,6 +35,7 @@ import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.MySQLDialect; import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.OracleDialect; import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.dialect.SybaseDialect; import org.hibernate.dialect.SybaseDialect;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
@ -273,6 +274,7 @@ public class NativeQueryResultTypeAutoDiscoveryTest {
@Test @Test
@SkipForDialect(value = OracleDialect.class, comment = "Oracle maps DATE and TIME to TIMESTAMP") @SkipForDialect(value = OracleDialect.class, comment = "Oracle maps DATE and TIME to TIMESTAMP")
@SkipForDialect(value = PostgresPlusDialect.class, comment = "EDB maps DATE and TIME to TIMESTAMP")
public void dateTimeTypes() { public void dateTimeTypes() {
createEntityManagerFactory( createEntityManagerFactory(
DateEntity.class, DateEntity.class,

View File

@ -27,8 +27,8 @@ import static org.junit.Assert.assertEquals;
@SkipForDialect(dialectClass = HSQLDialect.class) @SkipForDialect(dialectClass = HSQLDialect.class)
@SkipForDialect(dialectClass = DerbyDialect.class) @SkipForDialect(dialectClass = DerbyDialect.class)
@SkipForDialect(dialectClass = SybaseASEDialect.class) @SkipForDialect(dialectClass = SybaseASEDialect.class)
@SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 10) @SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 10, matchSubTypes = true)
@SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 11) // 'generated always' was added in 12 @SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 11, matchSubTypes = true) // 'generated always' was added in 12
public class GeneratedAlwaysTest { public class GeneratedAlwaysTest {
@Test @Test

View File

@ -12,6 +12,7 @@ import java.time.LocalDate;
import org.hibernate.dialect.AbstractHANADialect; import org.hibernate.dialect.AbstractHANADialect;
import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.OracleDialect; import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.dialect.SybaseASEDialect; import org.hibernate.dialect.SybaseASEDialect;
import jakarta.persistence.Column; import jakarta.persistence.Column;
@ -106,6 +107,7 @@ public class DateArrayTest extends BaseNonConfigCoreFunctionalTestCase {
@Test @Test
@SkipForDialect( value = AbstractHANADialect.class, comment = "For some reason, HANA can't intersect VARBINARY values, but funnily can do a union...") @SkipForDialect( value = AbstractHANADialect.class, comment = "For some reason, HANA can't intersect VARBINARY values, but funnily can do a union...")
@SkipForDialect( value = PostgresPlusDialect.class, comment = "Seems that comparing date[] through JDBC is buggy. ERROR: operator does not exist: timestamp without time zone[] = date[]")
public void testQuery() { public void testQuery() {
inSession( em -> { inSession( em -> {
TypedQuery<TableWithDateArrays> tq = em.createNamedQuery( "TableWithDateArrays.JPQL.getByData", TableWithDateArrays.class ); TypedQuery<TableWithDateArrays> tq = em.createNamedQuery( "TableWithDateArrays.JPQL.getByData", TableWithDateArrays.class );
@ -128,6 +130,7 @@ public class DateArrayTest extends BaseNonConfigCoreFunctionalTestCase {
@Test @Test
@SkipForDialect( value = HSQLDialect.class, comment = "HSQL does not like plain parameters in the distinct from predicate") @SkipForDialect( value = HSQLDialect.class, comment = "HSQL does not like plain parameters in the distinct from predicate")
@SkipForDialect( value = OracleDialect.class, comment = "Oracle requires a special function to compare XML") @SkipForDialect( value = OracleDialect.class, comment = "Oracle requires a special function to compare XML")
@SkipForDialect( value = PostgresPlusDialect.class, comment = "Seems that comparing date[] through JDBC is buggy. ERROR: operator does not exist: timestamp without time zone[] = date[]")
public void testNativeQuery() { public void testNativeQuery() {
inSession( em -> { inSession( em -> {
final String op = em.getJdbcServices().getDialect().supportsDistinctFromPredicate() ? "IS NOT DISTINCT FROM" : "="; final String op = em.getJdbcServices().getDialect().supportsDistinctFromPredicate() ? "IS NOT DISTINCT FROM" : "=";
@ -143,6 +146,7 @@ public class DateArrayTest extends BaseNonConfigCoreFunctionalTestCase {
@Test @Test
@RequiresDialectFeature(DialectChecks.SupportsArrayDataTypes.class) @RequiresDialectFeature(DialectChecks.SupportsArrayDataTypes.class)
@SkipForDialect( value = PostgresPlusDialect.class, comment = "The 'date' type is a synonym for timestamp on Oracle and PostgresPlus, so untyped reading produces Timestamps")
public void testNativeQueryUntyped() { public void testNativeQueryUntyped() {
inSession( em -> { inSession( em -> {
Query q = em.createNamedQuery( "TableWithDateArrays.Native.getByIdUntyped" ); Query q = em.createNamedQuery( "TableWithDateArrays.Native.getByIdUntyped" );