[libpostgresql-jdbc-java] 02/09: Merge fix from head for proper join to pg_description
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:18:59 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL7_3_2
in repository libpostgresql-jdbc-java.
commit ab8f157670b7caab1f20d13798a3eb28bb054923
Author: Barry Lind <barry at xythos.com>
Date: Mon Nov 11 07:30:08 2002 +0000
Merge fix from head for proper join to pg_description
Modified Files:
Tag: REL7_3_STABLE
jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
---
org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java | 4 ++--
org/postgresql/test/jdbc2/DatabaseMetaDataTest.java | 9 ++++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java b/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
index 2fd1a2b..2cae56e 100644
--- a/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
+++ b/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
@@ -1988,7 +1988,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
" END "+
" AS TABLE_TYPE, d.description AS REMARKS "+
" FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c "+
- " LEFT JOIN pg_catalog.pg_description d ON (c.oid = d.objoid) "+
+ " LEFT JOIN pg_catalog.pg_description d ON (c.oid = d.objoid AND d.objsubid = 0) "+
" LEFT JOIN pg_catalog.pg_class dc ON (d.classoid=dc.oid AND dc.relname='pg_class') "+
" LEFT JOIN pg_catalog.pg_namespace dn ON (dn.oid=dc.relnamespace AND dn.nspname='pg_catalog') "+
" WHERE c.relnamespace = n.oid ";
@@ -2038,7 +2038,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
if (connection.haveMinimumServerVersion("7.1")) {
select = "SELECT NULL AS TABLE_CAT, NULL AS TABLE_SCHEM, c.relname AS TABLE_NAME, "+tableType+" AS TABLE_TYPE, d.description AS REMARKS "+
" FROM pg_class c "+
- " LEFT JOIN pg_description d ON (c.oid=d.objoid) "+
+ " LEFT JOIN pg_description d ON (c.oid=d.objoid AND d.objsubid = 0) "+
" LEFT JOIN pg_class dc ON (d.classoid = dc.oid AND dc.relname='pg_class') "+
" WHERE true ";
} else {
diff --git a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
index 59d1f02..8adea3e 100644
--- a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+++ b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
@@ -28,6 +28,11 @@ public class DatabaseMetaDataTest extends TestCase
{
con = TestUtil.openDB();
TestUtil.createTable( con, "testmetadata", "id int4, name text, updated timestamp" );
+ Statement stmt = con.createStatement();
+ //we add the following comments to ensure the joins to the comments
+ //are done correctly. This ensures we correctly test that case.
+ stmt.execute("comment on table testmetadata is 'this is a table comment'");
+ stmt.execute("comment on column testmetadata.id is 'this is a column comment'");
}
protected void tearDown() throws Exception
{
@@ -44,12 +49,14 @@ public class DatabaseMetaDataTest extends TestCase
DatabaseMetaData dbmd = con.getMetaData();
assertNotNull(dbmd);
- ResultSet rs = dbmd.getTables( null, null, "test%", new String[] {"TABLE"});
+ ResultSet rs = dbmd.getTables( null, null, "testmetadat%", new String[] {"TABLE"});
assertTrue( rs.next() );
String tableName = rs.getString("TABLE_NAME");
assertTrue( tableName.equals("testmetadata") );
String tableType = rs.getString("TABLE_TYPE");
assertTrue( tableType.equals("TABLE") );
+ //There should only be one row returned
+ assertTrue( "getTables() returned too many rows", rs.next() == false);
rs.close();
rs = dbmd.getColumns("", "", "test%", "%" );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git
More information about the pkg-java-commits
mailing list