Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 863c9d1

Browse files
committed
I was trying to get a very nice FREE graphical db tool called DbVisualizer
(http://www.ideit.com/products/dbvis/) to work with Postgresql and I found out the following bug: if database has views then getTables() gets the null pointer exception ('order by relname' makes the listing tree in DbVisualizer a lot useful !!) This patch should propably be applied to the the jdbc1's DatabaseMetaData.java, too. Panu Outinen
1 parent 01cc344 commit 863c9d1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,14 +1697,17 @@ public java.sql.ResultSet getTables(String catalog, String schemaPattern, String
16971697
case 'S':
16981698
relKind = "SEQUENCE";
16991699
break;
1700+
case 'v':
1701+
relKind = "VIEW";
1702+
break;
17001703
default:
17011704
relKind = null;
17021705
}
17031706

17041707
tuple[0] = null; // Catalog name
17051708
tuple[1] = null; // Schema name
17061709
tuple[2] = r.getBytes(1); // Table name
1707-
tuple[3] = relKind.getBytes(); // Table type
1710+
tuple[3] = (relKind==null) ? null : relKind.getBytes(); // Table type
17081711
tuple[4] = remarks; // Remarks
17091712
v.addElement(tuple);
17101713
}

src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,14 +1697,17 @@ public java.sql.ResultSet getTables(String catalog, String schemaPattern, String
16971697
case 'S':
16981698
relKind = "SEQUENCE";
16991699
break;
1700+
case 'v':
1701+
relKind = "VIEW";
1702+
break;
17001703
default:
17011704
relKind = null;
17021705
}
17031706

17041707
tuple[0] = null; // Catalog name
17051708
tuple[1] = null; // Schema name
17061709
tuple[2] = r.getBytes(1); // Table name
1707-
tuple[3] = relKind.getBytes(); // Table type
1710+
tuple[3] = (relKind==null) ? null : relKind.getBytes(); // Table type
17081711
tuple[4] = remarks; // Remarks
17091712
v.addElement(tuple);
17101713
}

0 commit comments

Comments
 (0)