pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dmp <danap@ttc-cmc.net>
To: Deepak Beehyv <deepakram.beehyv@alationdata.com>
To: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: Regarding inclusion of indexes as tables
Date: Fri, 08 May 2015 10:45:45 -0600
Message-ID: <554CE839.3040801@ttc-cmc.net> (raw)
In-Reply-To: <CAAuCDTi5_KRTUZabmdUVO9GESoPqkAc7atvCGNddExnzEcOwEQ@mail.gmail.com>
References: <CAAuCDTi5_KRTUZabmdUVO9GESoPqkAc7atvCGNddExnzEcOwEQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Deepak Beehyv wrote:
> Hi all,
> We are trying to use the getColumns() and getTables() functions from
> DatabaseMetaData, but we are getting indexes as well in getTables() and
> indexColumns from getColumns() call. We are able to filter out indexes from
> getTables using tableType column available but were unable to do that for
> columns as tableType is not captured.
> I would like to know if getting indexes in getTables() and indexColumns in
> getColumns is warranted or a bug. If such a behaviour is warranted, is there any
> alternate solution.
>
> --
> regards
> N.Deepak Ram
>
>

Hello N.Deepak,

1. DatabaseMetaData.getTables()

Each databases seems to decide what table types are available for
this function call.

PostgreSQL

Table Types: FOREIGN TABLE
Table Types: INDEX
Table Types: MATERIALIZED VIEW
Table Types: SEQUENCE
Table Types: SYSTEM INDEX
Table Types: SYSTEM TABLE
Table Types: SYSTEM TOAST INDEX
Table Types: SYSTEM TOAST TABLE
Table Types: SYSTEM VIEW
Table Types: TABLE
Table Types: TEMPORARY INDEX
Table Types: TEMPORARY SEQUENCE
Table Types: TEMPORARY TABLE
Table Types: TEMPORARY VIEW
Table Types: TYPE
Table Types: VIEW

While, MariaDB

Table Types: BASE TABLE
Table Types: SYSTEM VIEW
Table Types: VIEW

If the database decides at its core to have index tables then
they are going to be returned unless filtered via getTables().

So this would seem warranted and not a bug.

2. DatabaseMetaData.getColumns()

According to the Java API:

Retrieves a description of table columns available in the specified catalog.

So it retrieves all columns in a db specified for every table unfiltered
by the arguments. If the table has indexes they will be retrieved.

So again this would seem correct and not a bug.

Perhaps a more specific description of what you are trying to accomplish
could help to more fully answer the question of an alternative solution?

danap








-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (6+ messages)  latest in thread

Message-ID: <554CE839.3040801@ttc-cmc.net>
Permalink:  ../554CE839.3040801@ttc-cmc.net/
Also on:    postgresql.org/message-id/554CE839.3040801@ttc-cmc.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: danap@ttc-cmc.net, deepakram.beehyv@alationdata.com
  Subject: Re: Regarding inclusion of indexes as tables
  In-Reply-To: <554CE839.3040801@ttc-cmc.net>
  References: <CAAuCDTi5_KRTUZabmdUVO9GESoPqkAc7atvCGNddExnzEcOwEQ@mail.gmail.com> <554CE839.3040801@ttc-cmc.net>

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

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