Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YqzgK-0002mM-Td for pgsql-jdbc@arkaria.postgresql.org; Sat, 09 May 2015 08:00:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YqzgJ-00016o-VQ for pgsql-jdbc@arkaria.postgresql.org; Sat, 09 May 2015 08:00:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YqzgI-00016O-30 for pgsql-jdbc@postgresql.org; Sat, 09 May 2015 08:00:18 +0000 Received: from smtp.procolix.com ([95.215.185.30]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1YqzgC-0001bH-Tc for pgsql-jdbc@postgresql.org; Sat, 09 May 2015 08:00:17 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.procolix.com (Postfix) with ESMTP id BB82D43D64 for ; Sat, 9 May 2015 10:00:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at smtp.procolix.com Received: from smtp.procolix.com ([127.0.0.1]) by localhost (host436.procolix.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0OhzXEM4zwHF for ; Sat, 9 May 2015 10:00:09 +0200 (CEST) Received: from [192.168.1.2] (5354002E.cm-6-5a.dynamic.ziggo.nl [83.84.0.46]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mark@lawinegevaar.nl) by smtp.procolix.com (Postfix) with ESMTPSA id 2430443B49 for ; Sat, 9 May 2015 10:00:09 +0200 (CEST) Message-ID: <554DBE8F.2030709@lawinegevaar.nl> Date: Sat, 09 May 2015 10:00:15 +0200 From: Mark Rotteveel Organization: Me, myself and I User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: PostgreSQL JDBC Subject: Re: Regarding inclusion of indexes as tables References: <554CE839.3040801@ttc-cmc.net> In-Reply-To: <554CE839.3040801@ttc-cmc.net> Content-Type: text/plain; charset=utf-8; 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 On 8-5-2015 18:45, dmp wrote: > 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? For background: I don't regularly use PostgreSQL so I don't know all its ins and outs. I develop Jaybird, the Firebird JDBC driver, and I recently joined this mailinglist to see and follow what users/developers of other JDBC drivers do and discuss (and the Firebird-java mailinglist is rather silent...). With that out of the way: as an outside observer having getTables and getColumns return index information sounds a bit curious: that is what getIndexInfo is for. Is an index in PostgreSQL selectable (as if it is a table) or can the index itself be referenced as a column (eg select index from table)? If not, I'd suggest that the information should not be part of getTables nor of getColumns. Mark -- Mark Rotteveel -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc