pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feed[pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
9+ messages / 3 participants
[nested] [flat]
* [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2024-12-19 17:09 "SophiahHo (@SophiahHo)" <[email protected]>
0 siblings, 0 replies; 9+ messages in thread
From: SophiahHo (@SophiahHo) @ 2024-12-19 17:09 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
**Describe the issue**
The method getColumns in pgjdbc's implementation of DatabaseMetaData returns `10` for CHAR_OCTET_LENGTH for column type `integer[]`. The JDBC spec [getColumns](https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getColumns-java.lang.String...-) says:
> CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
For non-character types, the returned value should be null.
**Driver Version?**
42.7.4
**Java Version?**
17
**PostgreSQL Version?**
13.13
**To Reproduce**
Create a table with an `integer[]` column type in your postgres DB's "public" schema:
```sql
create table myintegerarray (myintarray integer[]);
```
Java:
```java
String tablePattern = "myintegerarray";
ResultSet rs = connection.getMetaData().getColumns(null, "public", tablePattern, null);
rs.next();
System.out.println(rs.getString(16)); // CHAR_OCTET_LENGTH
```
Output:
```
10
```
**Expected behaviour**
Output:
```
null
```
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2024-12-19 19:31 ` "davecramer (@davecramer)" <[email protected]>
7 siblings, 0 replies; 9+ messages in thread
From: davecramer (@davecramer) @ 2024-12-19 19:31 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
At first glance I would agree with you, however looking at the docs you linked to they explicitly say where null is allowed and for CHAR_OCTET_LENGTH they don't say anything. So it appears to be up to the driver how to deal with it. I can ask the spec team what they think.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2024-12-19 20:43 ` "davecramer (@davecramer)" <[email protected]>
7 siblings, 0 replies; 9+ messages in thread
From: davecramer (@davecramer) @ 2024-12-19 20:43 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
I have some clarity
`CHAR_OCTET_LENGTH int => The maximum length of binary and character based columns. For any other datatype the returned value is a NULL`
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2024-12-20 10:51 ` "davecramer (@davecramer)" <[email protected]>
7 siblings, 0 replies; 9+ messages in thread
From: davecramer (@davecramer) @ 2024-12-20 10:51 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
So yes, I'd be OK with a PR that fixes this
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2025-04-05 11:03 ` "tirthgajera (@tirthgajera)" <[email protected]>
7 siblings, 0 replies; 9+ messages in thread
From: tirthgajera (@tirthgajera) @ 2025-04-05 11:03 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Hi @davecramer,
I would like to take this fix.
Can you assign this issue to me?
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2025-04-05 16:53 ` "davecramer (@davecramer)" <[email protected]>
7 siblings, 0 replies; 9+ messages in thread
From: davecramer (@davecramer) @ 2025-04-05 16:53 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
> Hi [@davecramer](https://github.com/davecramer), I would like to take this fix. Can you assign this issue to me?
done
Thanks!
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2025-04-05 19:51 ` "tirthgajera (@tirthgajera)" <[email protected]>
7 siblings, 0 replies; 9+ messages in thread
From: tirthgajera (@tirthgajera) @ 2025-04-05 19:51 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Hi @davecramer, I raise the pull request with this fix.
Please review it once and let me know if i need to take any other actions.
https://github.com/pgjdbc/pgjdbc/pull/3589
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2025-04-06 10:11 ` "tirthgajera (@tirthgajera)" <[email protected]>
7 siblings, 0 replies; 9+ messages in thread
From: tirthgajera (@tirthgajera) @ 2025-04-06 10:11 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Hi @davecramer,
For binary value do we really need to return maximum length of column, or null should be fine?
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types
@ 2025-04-06 10:46 ` "davecramer (@davecramer)" <[email protected]>
7 siblings, 0 replies; 9+ messages in thread
From: davecramer (@davecramer) @ 2025-04-06 10:46 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
As stated above `CHAR_OCTET_LENGTH int => The maximum length of binary and character based columns. For any other datatype the returned value is a NULL`
So for binary it is the maximum length.
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2025-04-06 10:46 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-19 17:09 [pgjdbc/pgjdbc] issue #3465: Metadata CHAR_OCTET_LENGTH is a positive number for non-character column types "SophiahHo (@SophiahHo)" <[email protected]>
2024-12-19 19:31 ` "davecramer (@davecramer)" <[email protected]>
2024-12-19 20:43 ` "davecramer (@davecramer)" <[email protected]>
2024-12-20 10:51 ` "davecramer (@davecramer)" <[email protected]>
2025-04-05 11:03 ` "tirthgajera (@tirthgajera)" <[email protected]>
2025-04-05 16:53 ` "davecramer (@davecramer)" <[email protected]>
2025-04-05 19:51 ` "tirthgajera (@tirthgajera)" <[email protected]>
2025-04-06 10:11 ` "tirthgajera (@tirthgajera)" <[email protected]>
2025-04-06 10:46 ` "davecramer (@davecramer)" <[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