updated patch from Mark Lillywhite per Tom Lane's comments: subtract VARHDRSZ first...
authorBarry Lind
Tue, 30 Oct 2001 05:09:51 +0000 (05:09 +0000)
committerBarry Lind
Tue, 30 Oct 2001 05:09:51 +0000 (05:09 +0000)
src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java

index 93b007719146ea622fc3082e1ee79da44f0c4766..594aaf5b7b30b78883bc2ca304bcadb8551d685e 100644 (file)
@@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException;
 /**
  * This class provides information about the database as a whole.
  *
- * $Id: DatabaseMetaData.java,v 1.40 2001/10/25 05:59:59 momjian Exp $
+ * $Id: DatabaseMetaData.java,v 1.41 2001/10/30 05:09:51 barry Exp $
  *
  * 

Many of the methods here return lists of information in ResultSets.  You

  * can use the normal ResultSet methods such as getString and getInt to
@@ -2014,12 +2014,12 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
            // Decimal digits = scale
            // From the source (see e.g. backend/utils/adt/numeric.c,
            // function numeric()) the scale and precision can be calculated
-           // from the typmod value. [email protected]
+           // from the typmod value.
            if (typname.equals("numeric") || typname.equals("decimal"))
            {
                int attypmod = r.getInt(8);
                tuple[8] =
-                   Integer.toString((attypmod & 0xffff) - VARHDRSZ).getBytes();
+                   Integer.toString((attypmod - VARHDRSZ) & 0xffff).getBytes();
            }
            else
                tuple[8] = "0".getBytes();