pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] issue #2027: PgDatabaseMetaData.getTables returns null table type for partitioned indexes
3+ messages / 3 participants
[nested] [flat]

* [pgjdbc/pgjdbc] issue #2027: PgDatabaseMetaData.getTables returns null table type for partitioned indexes
@ 2021-01-19 04:16  "tomdcc (@tomdcc)" <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: tomdcc (@tomdcc) @ 2021-01-19 04:16 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

**Describe the issue**
`PgDatabaseMetaData.getTables()` returns a `TABLE_TYPE` of [`PARTITIONED TABLE`](https://github.com/pgjdbc/pgjdbc/blob/375cb37/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMet...) for partitioned tables, but there are a couple of other [possible values for `relkind`](https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_class.h#L164-L173) that we don't currently support.

The one that I just bumped into is `I` for partitioned indexes. I propose that we return `PARTITIONED INDEX` for this case to be consistent with the behaviour for partitioned tables.

The other is `t` for some toast related tables. AFAICS in my db these only exist in the `toast` schema. This implies that we need another case [here](https://github.com/pgjdbc/pgjdbc/blob/375cb37/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMet...) that also returns `SYSTEM TOAST TABLE`. 

**Driver Version?** 
Currently using 42.2.18, but the code on master doesn't handle these.

**Java Version?**
11

**OS Version?**
N/A

**PostgreSQL Version?**
12

**To Reproduce**
Call `connection.getMetadata().getTables()` with some parameters that will match a partitioned index. Observe the null result in column `4` / `TABLE_TYPE`. I haven't tested it with toast tables, but have confirmed that tables with that `relkind` are in my db and that we don't currently handle that.

**Expected behaviour**
We return `PARTITIONED INDEX` AND `SYSTEM TOAST TABLE` for the two cases respectively.


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

* Re: [pgjdbc/pgjdbc] issue #2027: PgDatabaseMetaData.getTables returns null table type for partitioned indexes
@ 2021-01-19 10:38  "davecramer (@davecramer)" <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: davecramer (@davecramer) @ 2021-01-19 10:38 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Seems like something worth doing. 

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

* Re: [pgjdbc/pgjdbc] issue #2027: PgDatabaseMetaData.getTables returns null table type for partitioned indexes
@ 2025-07-15 10:04  "raminorujov (@raminorujov)" <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: raminorujov (@raminorujov) @ 2025-07-15 10:04 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

It is fixed already, can be closed.

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


end of thread, other threads:[~2025-07-15 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 04:16 [pgjdbc/pgjdbc] issue #2027: PgDatabaseMetaData.getTables returns null table type for partitioned indexes "tomdcc (@tomdcc)" <[email protected]>
2021-01-19 10:38 ` "davecramer (@davecramer)" <[email protected]>
2025-07-15 10:04 ` "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