pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: Support for 9.1 foreign tables
Date: Sat, 07 May 2011 14:52:31 +0200
Message-ID: <iq3fac$27f$1@dough.gmane.org> (raw)
In-Reply-To: <iq3b43$e7g$1@dough.gmane.org>
References: <iq3b43$e7g$1@dough.gmane.org>

Thomas Kellerer wrote on 07.05.2011 13:40:
> Hi,
>
> I just tried out the 9.1 driver (build 900) and noticed that it does
> not yet return the correct type for foreign tables.
>
> I have created a foreign table using the wrapper for text files
> (using the example here:
> http://www.depesz.com/index.php/2011/03/14/waiting-for-9-1-foreign-data-wrapper/comment-page-1/#comm...),
> and when using DatabaseMetaData.getTables() the returned type for
> that table is null. I assume that should contain "foreign table" to
> be inline with psql's display.
>
> The same is true for DatabaseMetaData.getTableTypes()
>
> I just wanted to mention it, to make sure that it's not forgotten ;)
>

After a quick look into the sources, this seems simple enough.

I have attached a path to implement these two missing things in case this has not yet been tackled.
(I hope the patch is OK, I haven't really done this before)


Regards
Thomas

Attachments:

foreign_table.patch (text/plain, 1.4K) download # This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. --- C:\Projects\pgjdbc\reference\pgjdbc\org\postgresql\jdbc2\AbstractJdbc2DatabaseMetaData.java +++ C:\Projects\pgjdbc\head\pgjdbc\org\postgresql\jdbc2\AbstractJdbc2DatabaseMetaData.java @@ -2027,6 +2027,7 @@ " WHEN 'S' THEN 'SEQUENCE' " + " WHEN 'v' THEN 'VIEW' " + " WHEN 'c' THEN 'TYPE' " + + " WHEN 'f' THEN 'FOREIGN TABLE' " + " ELSE NULL " + " END " + " ELSE NULL " + @@ -2136,6 +2137,9 @@ ht.put("SCHEMAS", "c.relkind = 'r' AND n.nspname !~ '^pg_' AND n.nspname <> 'information_schema'"); ht.put("NOSCHEMAS", "c.relkind = 'r' AND c.relname !~ '^pg_'"); ht = new Hashtable(); + tableTypeClauses.put("FOREIGN TABLE", ht); + ht.put("SCHEMAS", "c.relkind = 'f' AND n.nspname <> 'pg_catalog' AND n.nspname <> 'information_schema'"); + ht = new Hashtable(); tableTypeClauses.put("VIEW", ht); ht.put("SCHEMAS", "c.relkind = 'v' AND n.nspname <> 'pg_catalog' AND n.nspname <> 'information_schema'"); ht.put("NOSCHEMAS", "c.relkind = 'v' AND c.relname !~ '^pg_'");

view thread (4+ messages)  latest in thread

Message-ID: <iq3fac$27f$1@dough.gmane.org>
Permalink:  ../iq3fac$27f$1@dough.gmane.org/
Also on:    postgresql.org/message-id/iq3fac$27f$1@dough.gmane.org

 ·  · 

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: spam_eater@gmx.net
  Subject: Re: Support for 9.1 foreign tables
  In-Reply-To: <iq3fac$27f$1@dough.gmane.org>
  References: <iq3b43$e7g$1@dough.gmane.org> <iq3fac$27f$1@dough.gmane.org>

* 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