pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] issue #3564: CallableStatement.getParameterMetadata returns wrong parameter mode
2+ messages / 2 participants
[nested] [flat]

* [pgjdbc/pgjdbc] issue #3564: CallableStatement.getParameterMetadata returns wrong parameter mode
@ 2025-03-10 15:48 "DmitriyGod (@DmitriyGod)" <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: DmitriyGod (@DmitriyGod) @ 2025-03-10 15:48 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

**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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #3564: CallableStatement.getParameterMetadata returns wrong parameter mode
@ 2025-06-30 08:51 "raminorujov (@raminorujov)" <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: raminorujov (@raminorujov) @ 2025-06-30 08:51 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@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#get...-

```
 /**
   * {@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;
  }
```

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-06-30 08:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-10 15:48 [pgjdbc/pgjdbc] issue #3564: CallableStatement.getParameterMetadata returns wrong parameter mode "DmitriyGod (@DmitriyGod)" <[email protected]>
2025-06-30 08:51 Re: [pgjdbc/pgjdbc] issue #3564: CallableStatement.getParameterMetadata returns wrong parameter mode "raminorujov (@raminorujov)" <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox