1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-11 00:12:06 +03:00

Patch from Kris Jurka to improve the performance of getImportedKeys().

Use explicit joins to avoid using the genetic query optimizer.  Also fixed
a regression test that was failing to compile.  This change also cleans up
how key names are reported as per:
A change to the value of the FK_NAME column.  Currently the returned value
is the triggers arguments which look like

"<unnamed>\000t2\000t1\000UNSPECIFIED\000a\000a\000"

This was required for server versions < 7.3 when a user did not supply
constraint names.  Every constraint was named "<unnamed>"
.  7.3 has enforced unique constraint names per table so unnamed foreign
keys will have different names "$1", "$2" and so on.  I've used logic
along the lines of the following to preserve the unique names in the
original scheme, but allow people who go to the trouble of naming their
constraints to see them:

if (triggerargs.startsWith("<unnamed>")) {
	fkname = [the whole ugly trigger args name originally used];
} else {
	fkname = [the actual fk name];
}

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
 	jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
This commit is contained in:
Barry Lind
2003-01-14 05:05:26 +00:00
parent 956762a546
commit 88e524063a
2 changed files with 56 additions and 117 deletions

View File

@@ -11,7 +11,7 @@ import java.sql.*;
* interface to the PooledConnection is through the CPDS.
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.5 $
* @version $Revision: 1.6 $
*/
public class ConnectionPoolTest extends BaseDataSourceTest
{
@@ -391,38 +391,6 @@ public class ConnectionPoolTest extends BaseDataSourceTest
}
}
/**
* Ensures that the Statement proxy generated by the Connection handle
* throws the correct kind of exception.
*/
public void testStatementProxy() {
Statement s = null;
try
{
PooledConnection pc = getPooledConnection();
Connection con = pc.getConnection();
s = con.createStatement();
}
catch (SQLException e)
{
fail(e.getMessage());
}
try
{
s.executeQuery("SELECT * FROM THIS_TABLE_SHOULD_NOT_EXIST");
fail("An SQL exception was not thrown that should have been");
}
catch (SQLException e)
{
; // This is the expected and correct path
}
catch (Exception e)
{
fail("bad exception; was expecting SQLException, not" +
e.getClass().getName());
}
}
/**
* Ensures that a prepared statement generated by a proxied connection
* returns the proxied connection from getConnection() [not the physical