pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedSupport for 9.1 foreign tables
4+ messages / 3 participants
[nested] [flat]
* Support for 9.1 foreign tables
@ 2011-05-07 11:40 Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Kellerer @ 2011-05-07 11:40 UTC (permalink / raw)
To: pgsql-jdbc
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 ;)
Regards
Thomas
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Support for 9.1 foreign tables
@ 2011-05-07 12:52 Thomas Kellerer <spam_eater@gmx.net>
parent: Thomas Kellerer <spam_eater@gmx.net>
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Kellerer @ 2011-05-07 12:52 UTC (permalink / raw)
To: pgsql-jdbc
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_'");
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Support for 9.1 foreign tables
@ 2011-05-07 13:24 Kris Jurka <books@ejurka.com>
parent: Thomas Kellerer <spam_eater@gmx.net>
1 sibling, 0 replies; 4+ messages in thread
From: Kris Jurka @ 2011-05-07 13:24 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc
On Sat, 7 May 2011, Thomas Kellerer wrote:
> 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've checked in a fix for this to CVS.
Thanks for the report.
Kris Jurka
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Support for 9.1 foreign tables
@ 2011-05-07 13:39 Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>
parent: Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 0 replies; 4+ messages in thread
From: Johann 'Myrkraverk' Oskarsson @ 2011-05-07 13:39 UTC (permalink / raw)
To: pgsql-jdbc
On Sat, 07 May 2011 12:52:31 -0000, Thomas Kellerer <spam_eater@gmx.net>
wrote:
> After a quick look into the sources, this seems simple enough.
Seems you just have to checkout the repository.
From a few minutes ago on the commit list:
Log Message:
-----------
Correctly report the table type for FOREIGN TABLEs.
Reported by Thomas Kellerer.
Modified Files:
--------------
pgjdbc/org/postgresql/jdbc2:
AbstractJdbc2DatabaseMetaData.java (r1.66 -> r1.67)
(http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMe...)
--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2011-05-07 13:39 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-05-07 11:40 Support for 9.1 foreign tables Thomas Kellerer <spam_eater@gmx.net>
2011-05-07 12:52 ` Thomas Kellerer <spam_eater@gmx.net>
2011-05-07 13:39 ` Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>
2011-05-07 13:24 ` Kris Jurka <books@ejurka.com>
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