pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: tomdcc (@tomdcc) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #2027: PgDatabaseMetaData.getTables returns null table type for partitioned indexes
Date: Tue, 19 Jan 2021 04:16:01 +0000
Message-ID: <[email protected]> (raw)

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


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #2027: PgDatabaseMetaData.getTables returns null table type for partitioned indexes
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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