Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 483AA1337B88 for ; Fri, 5 Nov 2010 16:16:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 68026-02 for ; Fri, 5 Nov 2010 19:16:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id BF6B51337B8F for ; Fri, 5 Nov 2010 16:16:41 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PERmA-0005ua-Iu for pgsql-jdbc@postgresql.org; Fri, 05 Nov 2010 20:16:38 +0100 Received: from ppp-188-174-121-85.dynamic.mnet-online.de ([188.174.121.85]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Nov 2010 20:16:38 +0100 Received: from spam_eater by ppp-188-174-121-85.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Nov 2010 20:16:38 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Bug with DatabaseMetaData and temporary tables/schemas Date: Fri, 05 Nov 2010 20:16:26 +0100 Lines: 66 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ppp-188-174-121-85.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/7 X-Sequence-Number: 21128 Hi, DatabaseMetaData does not correctly report the implicitely created temporary schema when creating a temporary table. I ran the following code using a 9.0.1 database on Windows XP, with the postgresql-9.0-801.jdbc4.jar driver: rs = con.getMetaData().getSchemas(); System.out.println("before create table: "); while (rs.next()) { System.out.println("schema: " + rs.getString(1)); } rs.close(); stmt = con.createStatement(); stmt.execute("create temporary table foo (id integer)"); System.out.println("after create table: "); rs = con.getMetaData().getSchemas(); while (rs.next()) { System.out.println("schema: " + rs.getString(1)); } rs.close(); rs = stmt.executeQuery("select nspname from pg_namespace"); while (rs.next()) { System.out.println("schema from pg_namespace: " + rs.getString(1)); } rs.close(); On an otherwise empty database this produces the following output: before create table: schema: information_schema schema: pg_catalog schema: pg_toast_temp_1 schema: pg_toast_temp_2 schema: pg_toast_temp_3 schema: public after create table: schema: information_schema schema: pg_catalog schema: pg_toast_temp_1 schema: pg_toast_temp_2 schema: pg_toast_temp_3 schema: public schema from pg_namespace: pg_toast schema from pg_namespace: pg_temp_1 schema from pg_namespace: pg_toast_temp_1 schema from pg_namespace: pg_catalog schema from pg_namespace: information_schema schema from pg_namespace: public schema from pg_namespace: pg_temp_2 schema from pg_namespace: pg_toast_temp_2 schema from pg_namespace: pg_temp_3 schema from pg_namespace: pg_toast_temp_3 So the pg_temp_X schema(s) are there, but getSchemas() does not return them. Am I missing something, or is this a bug in the driver? Regards Thomas