Subject: [pgjdbc/pgjdbc] issue #3564: CallableStatement.getParameterMetadata returns wrong parameter mode

From: "DmitriyGod (@DmitriyGod)" <[email-masked]>
Date: Mon, 10 Mar 2025 15:48:53 +0000

**Describe the issue**
CallableStatement.getParameterMetadata returns wrong parameter mode

**Driver Version?** 
latest

**Java Version?**
any

**OS Version?**
any

**PostgreSQL Version?**
latest

**To Reproduce**
```SQL
create procedure p_date(in a date, out b date)
language plpgsql AS $$ begin b = a; end; $$;
```

```Java
var call = cn.prepareCall("call p_date(?, ?)");

call.getParameterMetaData().getParameterMode(1); // 1 as expected
call.getParameterMetaData().getParameterMode(2); // 1 but 4 expected
```
**Expected behaviour**
```Java
var call = cn.prepareCall("call p_date(?, ?)");

call.getParameterMetaData().getParameterMode(1); // 1 as expected
call.getParameterMetaData().getParameterMode(2); // 1 but 4 expected
```

**Logs**
No exceptions

---

From: "raminorujov (@raminorujov)" <[email-masked]>
Date: Mon, 30 Jun 2025 08:51:14 +0000

@DmitriyGod it's hardcoded to always return mode IN and ignores output parameters :)
See doc https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/jdbc/PgParameterMetaData.html#getParameterMode-int-

```
 /**
   * {@inheritDoc} For now report all parameters as inputs. CallableStatements may have one output,
   * but ignore that for now.
   */
  @Override
  public int getParameterMode(int param) throws SQLException {
    checkParamIndex(param);
    return ParameterMetaData.parameterModeIn;
  }
```