Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

JDBC: ResultSet.getObject(int, java.time.OffsetTime.class) fails for TIME_WITH_TIME_ZONE column

Aperta
#899 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, sql
Ambito
databases

Direzione di ricerca

Start by reproducing the failure with the time_tz_col TIME WITH TIME ZONE table from the issue and a ResultSet.getObject(1, OffsetTime.class) call. Then find where the driver converts a TIME_WITH_TIME_ZONE value for a requested Java class, and check why OffsetTime is reported by the metadata but rejected by the typed getter. Done means the call returns the stored time with its offset, and a regression test covers it.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug description

For a TIME WITH TIME ZONE column, DuckDB JDBC reports java.time.OffsetTime as the column class through ResultSetMetaData, but ResultSet.getObject(..., OffsetTime.class) fails with a conversion error.

Reproduction

Create a table containing a TIME WITH TIME ZONE column:

CREATE TABLE test_table (
    time_tz_col TIME WITH TIME ZONE NOT NULL
);

Execute a simple query:

SELECT time_tz_col FROM test_table;

The ResultSetMetaData correctly reports:

Metadata Value
getColumnName() time_tz_col
getColumnTypeName() TIME WITH TIME ZONE
getColumnType() 2013 (java.sql.Types.TIME_WITH_TIMEZONE)
getColumnClassName() java.time.OffsetTime

These metadata values appear correct and indicate that the JDBC driver maps TIME WITH TIME ZONE to java.time.OffsetTime.

However, attempting to retrieve the value using the corresponding JDBC typed getter fails:

OffsetTime value = resultSet.getObject(1, OffsetTime.class);

Results in:

java.sql.SQLException: Can't convert value to class java.time.OffsetTime, SQL type: TIME_WITH_TIME_ZONE
Environment
  • DuckDB JDBC: 1.5.6.0
  • SQL type: TIME WITH TIME ZONE
  • Java type reported by metadata: java.time.OffsetTime
  • JDBC type: java.sql.Types.TIME_WITH_TIMEZONE (2013)
Lingua principale
C++
Stelle
127
Fork
83
Merge medio
14h 35m
PR unite (30g)
45

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di duckdb/duckdb-java

Tutte le issue di duckdb/duckdb-java

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.