]> granicus.if.org Git - postgresql/commitdiff
DatabaseMetaData.getColumns() doesn't appear to get the default
authorBruce Momjian <bruce@momjian.us>
Sat, 21 Jul 2001 18:57:08 +0000 (18:57 +0000)
committerBruce Momjian <bruce@momjian.us>
Sat, 21 Jul 2001 18:57:08 +0000 (18:57 +0000)
value for each column. Here is a context diff of CVS which should
fix it.

Jason Davies

src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java

index a2c2e60db5c4ab6413a56e4747a51ed2b3af8a46..1df59803dddd41572da2ba1617458121b24f4869 100644 (file)
@@ -1936,7 +1936,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
 
     // Now form the query
     // Modified by Stefan Andreasen <stefan@linux.kapow.dk>
-    r = connection.ExecSQL("select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod from pg_class c, pg_attribute a where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 order by c.relname,a.attnum");
+    r = connection.ExecSQL("select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod,d.adsrc from pg_class c,pg_attribute a,pg_attrdef d where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 and c.oid=d.adrelid and d.adnum=a.attnum order by c.relname,a.attnum");
 
     byte remarks[];
 
@@ -1983,7 +1983,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
        // tuple[10] is below
        // tuple[11] is above
 
-       tuple[12] = null;       // column default
+       tuple[12] = r.getBytes(9);      // column default
 
        tuple[13] = null;       // sql data type (unused)
        tuple[14] = null;       // sql datetime sub (unused)
index df8aaf849f43b8377f2e5cbd0c4e27705b202deb..93e084f5368a18aeeab6cdf8360f9579470a99d5 100644 (file)
@@ -1936,7 +1936,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
 
     // Now form the query
     // Modified by Stefan Andreasen <stefan@linux.kapow.dk>
-    r = connection.ExecSQL("select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod from pg_class c, pg_attribute a where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 order by c.relname,a.attnum");
+    r = connection.ExecSQL("select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod,d.adsrc from pg_class c,pg_attribute a,pg_attrdef d where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 and c.oid=d.adrelid and d.adnum=a.attnum order by c.relname,a.attnum");
 
     byte remarks[];
 
@@ -1983,7 +1983,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
        // tuple[10] is below
        // tuple[11] is above
 
-       tuple[12] = null;       // column default
+       tuple[12] = r.getBytes(9);      // column default
 
        tuple[13] = null;       // sql data type (unused)
        tuple[14] = null;       // sql datetime sub (unused)