Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YqlF8-000496-Fn for pgsql-jdbc@arkaria.postgresql.org; Fri, 08 May 2015 16:35:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YqlF7-0007PX-TX for pgsql-jdbc@arkaria.postgresql.org; Fri, 08 May 2015 16:35:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YqlF7-0007Ow-99 for pgsql-jdbc@postgresql.org; Fri, 08 May 2015 16:35:17 +0000 Received: from rad0.itstriangle.com ([199.38.107.90]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1YqlF3-00015q-3g for pgsql-jdbc@postgresql.org; Fri, 08 May 2015 16:35:14 +0000 Received: from itstriangle.com (localhost [127.0.0.1]) by rad0.itstriangle.com (8.14.4/8.14.4) with ESMTP id t48GZ4Fn023417; Fri, 8 May 2015 12:35:07 -0400 Received: FROM [192.168.157.52] ([216.220.4.222]) BY itstriangle.com WITH ESMTP ; Fri, 8 May 2015 12:35:03 -0400 Message-ID: <554CE839.3040801@ttc-cmc.net> Date: Fri, 08 May 2015 10:45:45 -0600 From: dmp User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0 SeaMonkey/2.21 MIME-Version: 1.0 To: Deepak Beehyv , PostgreSQL JDBC Subject: Re: Regarding inclusion of indexes as tables References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org 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