Add test for stored procedures accepting array types.

Closes #3081
This commit is contained in:
Mark Paluch
2024-10-22 08:50:15 +02:00
parent cea33d5b42
commit eacdff8f6b
2 changed files with 26 additions and 0 deletions

View File

@@ -159,6 +159,14 @@ class PostgresStoredProcedureIntegrationTests {
assertThat(results).containsKey("some_cursor");
}
@Test // GH-3081
void supportsArrayTypes() {
String result = repository.accept_array(new String[] { "one", "two" });
assertThat(result).isEqualTo("[1:2]");
}
@Entity
@NamedStoredProcedureQuery( //
name = "get_employees_postgres", //
@@ -177,6 +185,11 @@ class PostgresStoredProcedureIntegrationTests {
@StoredProcedureParameter(mode = ParameterMode.REF_CURSOR, name = "some_cursor", type = void.class),
@StoredProcedureParameter(mode = ParameterMode.OUT, name = "result1", type = Integer.class),
@StoredProcedureParameter(mode = ParameterMode.OUT, name = "result2", type = Integer.class) })
@NamedStoredProcedureQuery( //
name = "Employee.accept_array", //
procedureName = "accept_array", //
parameters = { @StoredProcedureParameter(mode = ParameterMode.IN, name = "some_chars", type = String[].class),
@StoredProcedureParameter(mode = ParameterMode.OUT, name = "dims", type = String.class) })
@NamedStoredProcedureQuery( //
name = "positional_inout", //
procedureName = "positional_inout_parameter_issue3460", //
@@ -260,6 +273,9 @@ class PostgresStoredProcedureIntegrationTests {
@Procedure(value = "get_employees_count")
Integer noResultSet();
@Procedure(value = "accept_array")
String accept_array(String[] some_chars);
@Procedure(value = "multiple_out")
Map<String, Object> multiple_out(int someNumber);

View File

@@ -65,3 +65,13 @@ BEGIN
OPEN some_cursor FOR SELECT COUNT(*) FROM employee;
END;
$BODY$;;
CREATE OR REPLACE PROCEDURE accept_array(IN some_chars VARCHAR(255)[],
OUT dims VARCHAR(255))
LANGUAGE 'plpgsql'
AS
$BODY$
BEGIN
dims = array_dims(some_chars);
END;
$BODY$;;