[libpostgresql-jdbc-java] 09/11: DatabaseMetaData.getTypeInfo was reporting whether the type was signed or not, but the output column is really supposed to indicate whether the the type is unsigned or not.
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:33 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_2_509
in repository libpostgresql-jdbc-java.
commit 8d5bb3c4a38b2b3f9f1b13343d7151209ae7340c
Author: Kris Jurka <books at ejurka.com>
Date: Fri Nov 7 09:12:01 2008 +0000
DatabaseMetaData.getTypeInfo was reporting whether the type was signed
or not, but the output column is really supposed to indicate whether
the the type is unsigned or not.
Reported by Mythili Gopalakrishnan.
---
org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java | 4 ++--
org/postgresql/test/jdbc2/DatabaseMetaDataTest.java | 17 ++++++++++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
index b530e43..fb65ba3 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.33.2.2 2007/07/15 15:10:13 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.33.2.3 2007/07/23 17:30:46 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3570,7 +3570,7 @@ public abstract class AbstractJdbc2DatabaseMetaData
tuple[6] = bNullable; // all types can be null
tuple[7] = TypeInfoCache.isCaseSensitive(typeOid) ? bt : bf;
tuple[8] = bSearchable; // any thing can be used in the WHERE clause
- tuple[9] = TypeInfoCache.isSigned(typeOid) ? bt : bf;
+ tuple[9] = TypeInfoCache.isSigned(typeOid) ? bf : bt;
tuple[10] = bf; // false for now - must handle money
tuple[11] = bf; // false - it isn't autoincrement
tuple[13] = bZero; // min scale is zero
diff --git a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
index 26139b7..c7bbb9e 100644
--- a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+++ b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.36 2006/02/03 21:10:15 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.36.2.1 2007/04/11 07:33:26 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -512,6 +512,21 @@ public class DatabaseMetaDataTest extends TestCase
}
}
+ public void testTypeInfoSigned() throws SQLException
+ {
+ DatabaseMetaData dbmd = con.getMetaData();
+ ResultSet rs = dbmd.getTypeInfo();
+ while (rs.next()) {
+ if ("int4".equals(rs.getString("TYPE_NAME"))) {
+ assertEquals(false, rs.getBoolean("UNSIGNED_ATTRIBUTE"));
+ } else if ("float8".equals(rs.getString("TYPE_NAME"))) {
+ assertEquals(false, rs.getBoolean("UNSIGNED_ATTRIBUTE"));
+ } else if ("text".equals(rs.getString("TYPE_NAME"))) {
+ assertEquals(true, rs.getBoolean("UNSIGNED_ATTRIBUTE"));
+ }
+ }
+ }
+
public void testEscaping() throws SQLException {
DatabaseMetaData dbmd = con.getMetaData();
ResultSet rs = dbmd.getTables( null, null, "a'", new String[] {"TABLE"});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git
More information about the pkg-java-commits
mailing list