type cache info fix

From: Gary Baker <gary(dot)baker(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: type cache info fix
Date: 2013-03-29 17:08:04
Message-ID: CAE8acLAFcWVeLxqw+oHwvFfGdWO=XPN6NdGJ8nxMD8GfL0AbqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I found that type cache info wasn't honoring search path. (I had a
UDT type that shared a name with a table).

This fixed it.

diff --git a/org/postgresql/jdbc2/TypeInfoCache.java
b/org/postgresql/jdbc2/TypeInfoCache.java
index 2e79758..2d26fd0 100644
--- a/org/postgresql/jdbc2/TypeInfoCache.java
+++ b/org/postgresql/jdbc2/TypeInfoCache.java
@@ -234,7 +234,7 @@ public class TypeInfoCache implements TypeInfo {
if (_getOidStatement == null) {
String sql;
if (_conn.haveMinimumServerVersion("7.3")) {
- sql = "SELECT oid FROM pg_catalog.pg_type WHERE typname = ?";
+ sql = "SELECT ?::regtype::oid";
} else {
sql = "SELECT oid FROM pg_type WHERE typname = ?";
}

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message sushant.bose.1984@gmail.com 2013-03-30 18:04:34 Re: ERROR : column c.reltriggers does not exist
Previous Message Kris Jurka 2013-03-26 12:48:46 Re: patch to avoid a NullPointerException