pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedDiffrence between 8.0.3 and 8.1.3
5+ messages / 2 participants
[nested] [flat]
* Diffrence between 8.0.3 and 8.1.3
@ 2006-07-03 15:19 Yann PICHOT <ypichot@gmail.com>
2006-07-03 15:43 ` Re: Diffrence between 8.0.3 and 8.1.3 Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 5+ messages in thread
From: Yann PICHOT @ 2006-07-03 15:19 UTC (permalink / raw)
To: pgsql-jdbc
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Diffrence between 8.0.3 and 8.1.3
2006-07-03 15:19 Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
@ 2006-07-03 15:43 ` Kris Jurka <books@ejurka.com>
2006-07-05 06:57 ` Fwd: Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Kris Jurka @ 2006-07-03 15:43 UTC (permalink / raw)
To: Yann PICHOT <ypichot@gmail.com>; +Cc: pgsql-jdbc
On Mon, 3 Jul 2006, Yann PICHOT wrote:
> 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.
>
> 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));
>
> 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 cannot reproduce this with a 8.1.4 database and nothing in the
8.1.3 -> 8.1.4 release notes suggest that this behavior should have
changed. Are you sure you're exactly describing your test, jdbc driver,
and server versions?
Kris Jurka
^ permalink raw reply [nested|flat] 5+ messages in thread
* Fwd: Diffrence between 8.0.3 and 8.1.3
2006-07-03 15:19 Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
2006-07-03 15:43 ` Re: Diffrence between 8.0.3 and 8.1.3 Kris Jurka <books@ejurka.com>
@ 2006-07-05 06:57 ` Yann PICHOT <ypichot@gmail.com>
2006-07-05 19:31 ` Re: Fwd: [JDBC] Diffrence between 8.0.3 and 8.1.3 Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 5+ messages in thread
From: Yann PICHOT @ 2006-07-05 06:57 UTC (permalink / raw)
To: pgsql-jdbc
---------- Forwarded message ----------
From: Yann PICHOT <ypichot@gmail.com>
Date: 4 juil. 2006 10:07
Subject: Re: [JDBC] Diffrence between 8.0.3 and 8.1.3
To: Kris Jurka <books@ejurka.com>
2006/7/3, Yann PICHOT <ypichot@gmail.com>:
>
>
>
>
> Yes i describe exactly my test. Tomorrow, i download and install 8.1.4 and
> i test it again. I do my test with JDK 1.5.
>
> --
> Yann
>
Hi,
I install 8.1.4 and i do test and i have the same problem.
When i use this SQL request : SELECT col1, cast(' ' as varchar(3)) as mycol
FROM mytable, getColumnDisplaySize return -5.
When i use this SQL request : SELECT col1, cast(' ' as varchar(3)) as mycol,
getColumnDisplaySize return 3 !!!!
I do these tests with SQL_ASCII and LATIN9 database code page.
Regards,
--
Yann
--
Yann
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Fwd: [JDBC] Diffrence between 8.0.3 and 8.1.3
2006-07-03 15:19 Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
2006-07-03 15:43 ` Re: Diffrence between 8.0.3 and 8.1.3 Kris Jurka <books@ejurka.com>
2006-07-05 06:57 ` Fwd: Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
@ 2006-07-05 19:31 ` Kris Jurka <books@ejurka.com>
2006-07-06 13:17 ` Re: Fwd: Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Kris Jurka @ 2006-07-05 19:31 UTC (permalink / raw)
To: Yann PICHOT <ypichot@gmail.com>; +Cc: pgsql-jdbc; pgsql-bugs@postgresql.org
On Wed, 5 Jul 2006, Yann PICHOT wrote:
> When i use this SQL request : SELECT col1, cast(' ' as varchar(3)) as mycol
> FROM mytable, getColumnDisplaySize return -5.
> When i use this SQL request : SELECT col1, cast(' ' as varchar(3)) as mycol,
> getColumnDisplaySize return 3 !!!!
>
OK, I misunderstood your test case and was only looking at the second
version which works. As you noted earlier the server is responding with a
different typmod value, so this is not a JDBC problem, but a server
regression and I've forwarded this on to the -bugs list. To summarize for
them:
In 8.0 "SELECT ' '::varchar(3) FROM tab" retained the typmod value
specified in the query, but in 8.1 it is lost and -1 is used instead.
Kris Jurka
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Fwd: Diffrence between 8.0.3 and 8.1.3
2006-07-03 15:19 Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
2006-07-03 15:43 ` Re: Diffrence between 8.0.3 and 8.1.3 Kris Jurka <books@ejurka.com>
2006-07-05 06:57 ` Fwd: Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
2006-07-05 19:31 ` Re: Fwd: [JDBC] Diffrence between 8.0.3 and 8.1.3 Kris Jurka <books@ejurka.com>
@ 2006-07-06 13:17 ` Yann PICHOT <ypichot@gmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: Yann PICHOT @ 2006-07-06 13:17 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
2006/7/5, Kris Jurka <books@ejurka.com>:
>
>
>
> On Wed, 5 Jul 2006, Yann PICHOT wrote:
>
> > When i use this SQL request : SELECT col1, cast(' ' as varchar(3)) as
> mycol
> > FROM mytable, getColumnDisplaySize return -5.
> > When i use this SQL request : SELECT col1, cast(' ' as varchar(3)) as
> mycol,
> > getColumnDisplaySize return 3 !!!!
> >
>
> OK, I misunderstood your test case and was only looking at the second
> version which works. As you noted earlier the server is responding with a
> different typmod value, so this is not a JDBC problem, but a server
> regression and I've forwarded this on to the -bugs list. To summarize for
> them:
>
> In 8.0 "SELECT ' '::varchar(3) FROM tab" retained the typmod value
> specified in the query, but in 8.1 it is lost and -1 is used instead.
>
> Kris Jurka
>
Thanks, i'll follow the problem in the bug list.
--
Yann
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2006-07-06 13:17 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-03 15:19 Diffrence between 8.0.3 and 8.1.3 Yann PICHOT <ypichot@gmail.com>
2006-07-03 15:43 ` Kris Jurka <books@ejurka.com>
2006-07-05 06:57 ` Yann PICHOT <ypichot@gmail.com>
2006-07-05 19:31 ` Kris Jurka <books@ejurka.com>
2006-07-06 13:17 ` Yann PICHOT <ypichot@gmail.com>
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