From: Yann PICHOT <ypichot@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Diffrence between 8.0.3 and 8.1.3
Date: Mon, 3 Jul 2006 17:19:35 +0200
Message-ID: <6ff7932d0607030819o4775c43fr2762dd390d4cd76@mail.gmail.com> (raw)
Hi,
I use this JDBC Driver :
JDBC driver build number : 8.1.407-JDBC3
Server version : test do on 8.0.3 (linux), 8.1.3 (linux) and 8.1.2 (windows)
I have problem with the method getColumnDisplaySize in ResultSetMetaData
class.
I have this java program:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
public class Test {
public static void main(String[] args) {
try {
Properties props = new Properties();
Statement stmt = null;
Class.forName("org.postgresql.Driver");
props.put("user","xxxxx");
props.put("password","xxxxx");
Connection conn =
DriverManager.getConnection("jdbc:postgresql://myhost/mydatabase",
props);
try {
String SQLselect = "SELECT col1, cast(' ' as varchar(3)) as mycol
FROM mytable";
stmt = conn.createStatement();
ResultSet res = stmt.executeQuery(SQLselect);
ResultSetMetaData resMD = res.getMetaData();
System.out.println(resMD.getColumnDisplaySize(2));
res.close();
stmt.close();
} catch ( Exception e ) {
System.out.println("Error 1 : " + e.getMessage());
e.printStackTrace();
}
finally {
conn.close();
}
} catch ( Exception e) {
System.out.println("Error 2 : " + e.getMessage());
e.printStackTrace();
}
}
}
When i connect to 8.0.3 database the methode getColumnDisplaySize return 3,
a good value
When i connect to 8.1.2 or 8.1.3 database the methode getColumnDisplaySize
return -5, a bad value.
I saw the source of the JDBC Driver and i saw the difference is in data read
on socket in the method receiveFields in QueryExecutorImpl class.
When i connect to 8.0.3 database, on this line of the method :
...
int typeModifier = pgStream.ReceiveIntegerR(4);
...
typeModifier is set to 7.
When i conenct to 8.1.2 or 8.1.3, typeModifier is set to -1
Is it normal ? Someone can explain this ?
Regards,
--
Yann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: ypichot@gmail.com
Subject: Re: Diffrence between 8.0.3 and 8.1.3
In-Reply-To: <6ff7932d0607030819o4775c43fr2762dd390d4cd76@mail.gmail.com>
References: <6ff7932d0607030819o4775c43fr2762dd390d4cd76@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox