Patch for getBestRowIdentifier (for testing with Oracle JDeveloper)

Haris Peco <snpe@snpe.co.yu>

From: snpe <snpe@snpe.co.yu>
To: Dave Cramer <Dave@micro-automation.net>
Cc: pgsql-jdbc <pgsql-jdbc@postgresql.org>
Date: 2002-09-11T20:38:08Z
Lists: pgsql-hackers
Please appl
--- AbstractJdbc1DatabaseMetaData.java	Wed Sep 11 22:21:25 2002
+++ AbstractJdbc1DatabaseMetaData.java.orig	Wed Sep 11 22:20:36 2002
@@ -2381,44 +2381,21 @@
 	// Implementation note: This is required for Borland's JBuilder to work
 	public java.sql.ResultSet getBestRowIdentifier(String catalog, String 
schema, String table, int scope, boolean nullable) throws SQLException
 	{
-		if (connection.haveMinimumServerVersion("7.3")) {
-			StringBuffer sql = new StringBuffer(512);
-			sql.append("SELECT " +
-				scope + " as SCOPE," +
-				"a.attname as COLUMN_NAME," +
-				"a.atttypid as DATA_TYPE," +
-				"t.typname as TYPE_NAME," +
-				"t.typlen as COLUMN_SIZE," +
-				"0::int4 as BUFFER_LENGTH," +
-				"0::int4 as DECIMAL_DIGITS," +
-				"0::int4 as PSEUDO_COLUMN " +
-		 	"FROM pg_catalog.pg_type t,pg_catalog.pg_class bc," +
-				"pg_catalog.pg_class ic, pg_catalog.pg_index i, pg_catalog.pg_attribute a 
" +
-		 	"WHERE bc.relkind = 'r' " +
-		  	"AND t.oid=a.atttypid " +
-		  	"AND upper(bc.relname) = upper('" + table + "') " +
-		  	"AND i.indrelid = bc.oid " +
-		  	"AND i.indexrelid = ic.oid " +
-		  	"AND ic.oid = a.attrelid " +
-		  	"AND i.indisprimary='t' ");
-			return connection.createStatement().executeQuery(sql.toString());
-		} else {
-			// for now, this returns an empty result set.
-			Field f[] = new Field[8];
-			ResultSet r;	// ResultSet for the SQL query that we need to do
-			Vector v = new Vector();		// The new ResultSet tuple stuff
+		// for now, this returns an empty result set.
+		Field f[] = new Field[8];
+		ResultSet r;	// ResultSet for the SQL query that we need to do
+		Vector v = new Vector();		// The new ResultSet tuple stuff
 
-			f[0] = new Field(connection, "SCOPE", iInt2Oid, 2);
-			f[1] = new Field(connection, "COLUMN_NAME", iVarcharOid, NAME_SIZE);
-			f[2] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
-			f[3] = new Field(connection, "TYPE_NAME", iVarcharOid, NAME_SIZE);
-			f[4] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
-			f[5] = new Field(connection, "BUFFER_LENGTH", iInt4Oid, 4);
-			f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2);
-			f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2);
+		f[0] = new Field(connection, "SCOPE", iInt2Oid, 2);
+		f[1] = new Field(connection, "COLUMN_NAME", iVarcharOid, NAME_SIZE);
+		f[2] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+		f[3] = new Field(connection, "TYPE_NAME", iVarcharOid, NAME_SIZE);
+		f[4] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
+		f[5] = new Field(connection, "BUFFER_LENGTH", iInt4Oid, 4);
+		f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2);
+		f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2);
 
-			return connection.getResultSet(null, f, v, "OK", 1);
-		}
+		return connection.getResultSet(null, f, v, "OK", 1);
 	}
 
 	/*