Upgrade to Postgres 11 for integration testing.
Postgres stored procedures requires some adjustments in order to upgrade to Postgres 11. See #2903
This commit is contained in:
@@ -47,6 +47,7 @@ import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.data.jpa.repository.query.Procedure;
|
||||
import org.springframework.data.jpa.util.DisabledOnHibernate61;
|
||||
import org.springframework.data.jpa.util.DisabledOnHibernate62;
|
||||
import org.springframework.jdbc.datasource.init.DataSourceInitializer;
|
||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
@@ -68,6 +69,7 @@ import org.testcontainers.containers.PostgreSQLContainer;
|
||||
* @author Greg Turnquist
|
||||
* @author Yanming Zhou
|
||||
*/
|
||||
@DisabledOnHibernate61 // GH-2903
|
||||
@Transactional
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = PostgresStoredProcedureIntegrationTests.Config.class)
|
||||
@@ -203,7 +205,7 @@ public class PostgresStoredProcedureIntegrationTests {
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
public PostgreSQLContainer<?> container() {
|
||||
|
||||
return new PostgreSQLContainer<>("postgres:9.6.12") //
|
||||
return new PostgreSQLContainer<>("postgres:15.3") //
|
||||
.withUsername("postgres");
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Temporal;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.data.jpa.repository.query.Procedure;
|
||||
import org.springframework.data.jpa.util.DisabledOnHibernate61;
|
||||
import org.springframework.jdbc.datasource.init.DataSourceInitializer;
|
||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
|
||||
@@ -62,6 +63,7 @@ import org.testcontainers.containers.PostgreSQLContainer;
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
@DisabledOnHibernate61 // GH-2903
|
||||
@Transactional
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = PostgresStoredProcedureNullHandlingIntegrationTests.Config.class)
|
||||
@@ -109,7 +111,7 @@ public class PostgresStoredProcedureNullHandlingIntegrationTests {
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
public PostgreSQLContainer<?> container() {
|
||||
|
||||
return new PostgreSQLContainer<>("postgres:10.21") //
|
||||
return new PostgreSQLContainer<>("postgres:15.3") //
|
||||
.withUsername("postgres");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ CREATE TABLE test_model
|
||||
CONSTRAINT test_model_pk PRIMARY KEY (ID)
|
||||
);;
|
||||
|
||||
CREATE OR REPLACE FUNCTION countByUuid(this_uuid uuid)
|
||||
RETURNS int
|
||||
CREATE OR REPLACE PROCEDURE countByUuid(IN this_uuid uuid)
|
||||
LANGUAGE 'plpgsql'
|
||||
AS
|
||||
$BODY$
|
||||
@@ -18,13 +17,11 @@ BEGIN
|
||||
INTO c
|
||||
FROM test_model
|
||||
WHERE test_model.uuid = this_uuid;
|
||||
RETURN c;
|
||||
END;
|
||||
$BODY$
|
||||
;;
|
||||
|
||||
CREATE OR REPLACE FUNCTION countByLocalDate(this_local_date DATE)
|
||||
RETURNS int
|
||||
CREATE OR REPLACE PROCEDURE countByLocalDate(IN this_local_date DATE)
|
||||
LANGUAGE 'plpgsql'
|
||||
AS
|
||||
$BODY$
|
||||
@@ -35,7 +32,6 @@ BEGIN
|
||||
INTO c
|
||||
FROM test_model
|
||||
WHERE test_model.local_date = this_local_date;
|
||||
RETURN c;
|
||||
END;
|
||||
$BODY$
|
||||
;;
|
||||
|
||||
@@ -8,38 +8,29 @@ CREATE TABLE employee
|
||||
INSERT INTO employee (ID, NAME) VALUES (3, 'Fanny');;
|
||||
INSERT INTO employee (ID, NAME) VALUES (4, 'Gabriel');;
|
||||
|
||||
CREATE OR REPLACE FUNCTION get_employees()
|
||||
RETURNS refcursor
|
||||
CREATE OR REPLACE PROCEDURE get_employees(OUT ref refcursor)
|
||||
LANGUAGE 'plpgsql'
|
||||
AS
|
||||
$BODY$
|
||||
DECLARE
|
||||
ref refcursor;
|
||||
BEGIN
|
||||
OPEN ref FOR SELECT * FROM employee;
|
||||
RETURN ref;
|
||||
END;
|
||||
$BODY$;;
|
||||
|
||||
CREATE OR REPLACE FUNCTION get_employees_count()
|
||||
RETURNS integer
|
||||
CREATE OR REPLACE PROCEDURE get_employees_count(OUT results integer)
|
||||
LANGUAGE 'plpgsql'
|
||||
AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
RETURN (SELECT COUNT(*) FROM employee);
|
||||
results = (SELECT COUNT(*) FROM employee);
|
||||
END;
|
||||
$BODY$;;
|
||||
|
||||
CREATE OR REPLACE FUNCTION get_single_employee()
|
||||
RETURNS refcursor
|
||||
CREATE OR REPLACE PROCEDURE get_single_employee(OUT ref refcursor)
|
||||
LANGUAGE 'plpgsql'
|
||||
AS
|
||||
$BODY$
|
||||
DECLARE
|
||||
ref refcursor;
|
||||
BEGIN
|
||||
OPEN ref FOR SELECT * FROM employee WHERE employee.ID = 3;
|
||||
RETURN ref;
|
||||
END;
|
||||
$BODY$;;
|
||||
|
||||
Reference in New Issue
Block a user