]> granicus.if.org Git - postgresql/commitdiff
This patch implements the following command:
authorBruce Momjian <bruce@momjian.us>
Tue, 12 Sep 2000 05:09:57 +0000 (05:09 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 12 Sep 2000 05:09:57 +0000 (05:09 +0000)
ALTER TABLE <tablename> OWNER TO <username>

Only a superuser may execute the command.

--
Mark Hollomon
mhh@mindspring.com

src/backend/commands/command.c
src/backend/parser/gram.y
src/backend/parser/keywords.c
src/backend/tcop/utility.c
src/include/commands/command.h
src/include/nodes/parsenodes.h
src/interfaces/jdbc/org/postgresql/Connection.java
src/interfaces/jdbc/org/postgresql/Driver.java
src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java

index d0faa943cfd620047e0b8d293ea3ad3abbeacd68..9535e19741750216ae12bc1842de28c8b536a1d8 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.101 2000/09/12 04:49:06 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.102 2000/09/12 05:09:43 momjian Exp $
  *
  * NOTES
  *       The PerformAddAttribute() code, like most of the relation
@@ -47,6 +47,7 @@
 #include "utils/temprel.h"
 #include "executor/spi_priv.h"
 #include "catalog/pg_index.h"
+#include "catalog/pg_shadow.h"
 #include "utils/relcache.h"
 
 #ifdef _DROP_COLUMN_HACK__
@@ -1449,6 +1450,70 @@ AlterTableDropConstraint(const char *relationName,
 
 
 
+/*
+ * ALTER TABLE OWNER
+ */
+void
+AlterTableOwner(const char *relationName, const char *newOwnerName)
+{
+       Relation        class_rel;
+       HeapTuple       tuple;
+       int4            newOwnerSysid;
+       Relation        idescs[Num_pg_class_indices];
+
+       /*
+        * first check that we are a superuser
+        */
+       if (! superuser() )
+               elog(ERROR, "ALTER TABLE: permission denied");
+
+       /*
+        * look up the new owner in pg_shadow and get the sysid
+        */
+       tuple = SearchSysCacheTuple(SHADOWNAME, PointerGetDatum(newOwnerName),
+                                                          0, 0, 0);
+       if (!HeapTupleIsValid(tuple))
+               elog(ERROR, "ALTER TABLE: user \"%s\" not found", newOwnerName);
+
+       newOwnerSysid = ((Form_pg_shadow) GETSTRUCT(tuple))->usesysid;
+       heap_freetuple(tuple);
+
+       /*
+        * find the table's entry in pg_class and lock it for writing
+        */
+       class_rel = heap_openr(RelationRelationName, RowExclusiveLock);
+
+       tuple = SearchSysCacheTuple(RELNAME, PointerGetDatum(relationName),
+                                                                0, 0, 0);
+       if (!HeapTupleIsValid(tuple))
+               elog(ERROR, "ALTER TABLE: relation \"%s\" not found",
+                        relationName);
+
+       if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_RELATION)
+               elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table",
+                               relationName);
+
+       /*
+        * modify the table's entry and write to the heap
+        */
+       ((Form_pg_class) GETSTRUCT(tuple))->relowner = newOwnerSysid;
+
+       heap_update(class_rel, &tuple->t_self, tuple, NULL);
+
+       /* Keep the catalog indices up to date */
+       CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs);
+       CatalogIndexInsert(idescs, Num_pg_class_indices, class_rel, tuple);
+       CatalogCloseIndices(Num_pg_class_indices, idescs);
+
+       /*
+        * unlock everything and return
+        */
+       heap_freetuple(tuple);
+       heap_close(class_rel, RowExclusiveLock);
+
+       return;
+}
+
 /*
  * ALTER TABLE CREATE TOAST TABLE
  */
index d57fcddaaec22c06bb6edf347cc06303f3a28d1c..7e970ab1871d6d50420d2ae0c7a505fd8afae19c 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.187 2000/08/26 21:53:43 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.188 2000/09/12 05:09:44 momjian Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -350,7 +350,7 @@ static void doNegateFloat(Value *v);
                LANCOMPILER, LIMIT, LISTEN, LOAD, LOCATION, LOCK_P,
                MAXVALUE, MINVALUE, MODE, MOVE,
                NEW, NOCREATEDB, NOCREATEUSER, NONE, NOTHING, NOTIFY, NOTNULL,
-               OFFSET, OIDS, OPERATOR, PASSWORD, PROCEDURAL,
+               OFFSET, OIDS, OPERATOR, OWNER, PASSWORD, PROCEDURAL,
                REINDEX, RENAME, RESET, RETURNS, ROW, RULE,
                SEQUENCE, SERIAL, SETOF, SHARE, SHOW, START, STATEMENT, STDIN, STDOUT, SYSID,
                TEMP, TOAST, TRUNCATE, TRUSTED, 
@@ -1031,6 +1031,16 @@ AlterTableStmt:
                                        n->relname = $3;
                                        $$ = (Node *)n;
                                }
+
+/* ALTER TABLE <name> OWNER TO UserId */
+               | ALTER TABLE relation_name OWNER TO UserId
+                               {
+                                       AlterTableStmt *n = makeNode(AlterTableStmt);
+                                       n->subtype = 'U';
+                                       n->relname = $3;
+                                       n->name = $6;
+                                       $$ = (Node *)n;
+                               }
                ;
 
 alter_column_action:
@@ -5641,6 +5651,7 @@ TokenId:  ABSOLUTE                                                { $$ = "absolute"; }
                | OIDS                                                  { $$ = "oids"; }
                | OPERATOR                                              { $$ = "operator"; }
                | OPTION                                                { $$ = "option"; }
+               | OWNER                                                 { $$ = "owner"; }
                | PARTIAL                                               { $$ = "partial"; }
                | PASSWORD                                              { $$ = "password"; }
                | PENDANT                                               { $$ = "pendant"; }
index 848f1dc8d6b8d33fa9f658ef5baa241806ee5803..3562537c0a8e4b383dfc3c4b18788c3b42923d10 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.80 2000/08/06 18:05:22 thomas Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.81 2000/09/12 05:09:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -196,6 +196,7 @@ static ScanKeyword ScanKeywords[] = {
        {"out", OUT},
        {"outer", OUTER_P},
        {"overlaps", OVERLAPS},
+       {"owner", OWNER},
        {"partial", PARTIAL},
        {"password", PASSWORD},
        {"path", PATH_P},
index d603914c514a65f46e13436b258ad59260621b22..9edb092e62da06be7cef3b62b7f60afc8dbac6f3 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.93 2000/09/12 04:49:11 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.94 2000/09/12 05:09:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -371,6 +371,9 @@ ProcessUtility(Node *parsetree,
                                        case 'E':       /* CREATE TOAST TABLE */
                                                AlterTableCreateToastTable(stmt->relname, false);
                                                break;
+                                       case 'U':       /* ALTER OWNER */
+                                               AlterTableOwner(stmt->relname, stmt->name);
+                                               break;
                                        default:        /* oops */
                                                elog(ERROR, "T_AlterTableStmt: unknown subtype");
                                                break;
index e83b30a0ef6837b2a8379c064d523bae5329d98d..4f2cfba2f12b7ea777834bd8e4dfb63ebf5c5d92 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: command.h,v 1.22 2000/07/18 03:57:32 tgl Exp $
+ * $Id: command.h,v 1.23 2000/09/12 05:09:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -61,6 +61,8 @@ extern void AlterTableDropConstraint(const char *relationName,
 extern void AlterTableCreateToastTable(const char *relationName,
                          bool silent);
 
+extern void AlterTableOwner(const char *relationName, const char *newOwnerName);
+
 /*
  * LOCK
  */
index 1d2a7ce813fe19d36c52ed18943ece1c6a473eb5..f6c75c197810f96634539b9173be7b38cf14da24 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.111 2000/08/11 23:46:54 tgl Exp $
+ * $Id: parsenodes.h,v 1.112 2000/09/12 05:09:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -95,11 +95,13 @@ typedef struct Query
 typedef struct AlterTableStmt
 {
        NodeTag         type;
-       char            subtype;                /* A = add, T = alter, D = drop, C = add
-                                                                * constr, X = drop constr */
+       char            subtype;                /* A = add column, T = alter column, D = drop column,
+                                                                * C = add constraint, X = drop constraint,
+                                                                * E = add toast table,
+                                                                * U = change owner */
        char       *relname;            /* table to work on */
        bool            inh;                    /* recursively on children? */
-       char       *name;                       /* column or constraint name to act on */
+       char       *name;                       /* column or constraint name to act on, or new owner */
        Node       *def;                        /* definition of new column or constraint */
        int                     behavior;               /* CASCADE or RESTRICT drop behavior */
 } AlterTableStmt;
index 33834118bdab309621d56ce4048ce21a97bfbc06..fc908a43e9ef0f1718b1e74e451840625602e6af 100644 (file)
@@ -10,7 +10,7 @@ import org.postgresql.largeobject.*;
 import org.postgresql.util.*;
 
 /**
- * $Id: Connection.java,v 1.5 2000/09/12 04:58:47 momjian Exp $
+ * $Id: Connection.java,v 1.6 2000/09/12 05:09:54 momjian Exp $
  *
  * This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
  * JDBC2 versions of the Connection class.
@@ -112,12 +112,12 @@ public abstract class Connection
       throw new PSQLException("postgresql.con.pass");
     
     this_driver = d;
-    this_url = new String(url);
-    PG_DATABASE = new String(database);
-    PG_PASSWORD = new String(info.getProperty("password"));
-    PG_USER = new String(info.getProperty("user"));
+    this_url = url;
+    PG_DATABASE = database;
+    PG_PASSWORD = info.getProperty("password");
+    PG_USER = info.getProperty("user");
     PG_PORT = port;
-    PG_HOST = new String(host);
+    PG_HOST = host;
     PG_STATUS = CONNECTION_BAD;
 
     encoding = info.getProperty("charSet");  // could be null
index d5a5c8d24fe1fb7172908dac172bb342d6cf2811..849bb71d54d6c0e47457aac8f571a82c4956e5f4 100644 (file)
@@ -242,8 +242,8 @@ public class Driver implements java.sql.Driver
   {
     int state = -1;
     Properties urlProps = new Properties(defaults);
-    String key = new String();
-    String value = new String();
+    String key = "";
+    String value = "";
     
     StringTokenizer st = new StringTokenizer(url, ":/;=&?", true);
     for (int count = 0; (st.hasMoreTokens()); count++) {
index e482809954d7c39d3363eb557f9e62a27277f809..52e871e1697dc81d8972f847f3773954a0d66630 100644 (file)
@@ -161,7 +161,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getDatabaseProductName() throws SQLException
   {
-    return new String("PostgreSQL");
+    return "PostgreSQL";
   }
   
   /**
@@ -191,7 +191,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getDriverName() throws SQLException
   {
-    return new String("PostgreSQL Native Driver");
+    return "PostgreSQL Native Driver";
   }
   
   /**
@@ -203,7 +203,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getDriverVersion() throws SQLException
   {
-    return new String(Integer.toString(connection.this_driver.getMajorVersion())+"."+Integer.toString(connection.this_driver.getMinorVersion()));
+    return Integer.toString(connection.this_driver.getMajorVersion())+"."+Integer.toString(connection.this_driver.getMinorVersion());
   }
   
   /**
@@ -384,7 +384,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getSQLKeywords() throws SQLException
   {
-    return new String("abort,acl,add,aggregate,append,archive,arch_store,backward,binary,change,cluster,copy,database,delimiters,do,extend,explain,forward,heavy,index,inherits,isnull,light,listen,load,merge,nothing,notify,notnull,oids,purge,rename,replace,retrieve,returns,rule,recipe,setof,stdin,stdout,store,vacuum,verbose,version");
+    return "abort,acl,add,aggregate,append,archive,arch_store,backward,binary,change,cluster,copy,database,delimiters,do,extend,explain,forward,heavy,index,inherits,isnull,light,listen,load,merge,nothing,notify,notnull,oids,purge,rename,replace,retrieve,returns,rule,recipe,setof,stdin,stdout,store,vacuum,verbose,version";
   }
   
   public String getNumericFunctions() throws SQLException
@@ -420,7 +420,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getSearchStringEscape() throws SQLException
   {
-    return new String("\\");
+    return "\\";
   }
   
   /**
@@ -436,7 +436,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getExtraNameCharacters() throws SQLException
   {
-    return new String("");
+    return "";
   }
   
   /**
@@ -773,7 +773,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getSchemaTerm() throws SQLException
   {
-    return new String("Schema");
+    return "Schema";
   }
   
   /**
@@ -785,7 +785,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getProcedureTerm() throws SQLException
   {
-    return new String("Procedure");
+    return "Procedure";
   }
   
   /**
@@ -797,7 +797,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getCatalogTerm() throws SQLException
   {
-    return new String("Catalog");
+    return "Catalog";
   }
   
   /**
@@ -823,7 +823,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
   public String getCatalogSeparator() throws SQLException
   {
     // PM Sep 29 97 - changed from "." as we don't support catalogs.
-    return new String("");
+    return "";
   }
   
   /**
@@ -1578,19 +1578,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     ResultSet r;       // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("PROCEDURE_CAT"), iVarcharOid, 32);
-    f[1] = new Field(connection, new String("PROCEDURE_SCHEM"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("PROCEDURE_NAME"), iVarcharOid, 32);
-    f[3] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
-    f[4] = new Field(connection, new String("COLUMN_TYPE"), iInt2Oid, 2);
-    f[5] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
-    f[6] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
-    f[7] = new Field(connection, new String("PRECISION"), iInt4Oid, 4);
-    f[8] = new Field(connection, new String("LENGTH"), iInt4Oid, 4);
-    f[9] = new Field(connection, new String("SCALE"), iInt2Oid, 2);
-    f[10] = new Field(connection, new String("RADIX"), iInt2Oid, 2);
-    f[11] = new Field(connection, new String("NULLABLE"), iInt2Oid, 2);
-    f[12] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
+    f[0] = new Field(connection, "PROCEDURE_CAT", iVarcharOid, 32);
+    f[1] = new Field(connection, "PROCEDURE_SCHEM", iVarcharOid, 32);
+    f[2] = new Field(connection, "PROCEDURE_NAME", iVarcharOid, 32);
+    f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+    f[4] = new Field(connection, "COLUMN_TYPE", iInt2Oid, 2);
+    f[5] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+    f[6] = new Field(connection, "TYPE_NAME", iVarcharOid, 32);
+    f[7] = new Field(connection, "PRECISION", iInt4Oid, 4);
+    f[8] = new Field(connection, "LENGTH", iInt4Oid, 4);
+    f[9] = new Field(connection, "SCALE", iInt2Oid, 2);
+    f[10] = new Field(connection, "RADIX", iInt2Oid, 2);
+    f[11] = new Field(connection, "NULLABLE", iInt2Oid, 2);
+    f[12] = new Field(connection, "REMARKS", iVarcharOid, 32);
     
     // add query loop here
     
@@ -1644,11 +1644,11 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     java.sql.ResultSet r;      // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("TABLE_CAT"), iVarcharOid, 32);
-    f[1] = new Field(connection, new String("TABLE_SCHEM"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("TABLE_NAME"), iVarcharOid, 32);
-    f[3] = new Field(connection, new String("TABLE_TYPE"), iVarcharOid, 32);
-    f[4] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
+    f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, 32);
+    f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
+    f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
+    f[3] = new Field(connection, "TABLE_TYPE", iVarcharOid, 32);
+    f[4] = new Field(connection, "REMARKS", iVarcharOid, 32);
     
     // Now form the query
     StringBuffer sql = new StringBuffer("select relname,oid,relkind from pg_class where (");
@@ -1755,7 +1755,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     Field f[] = new Field[1];
     Vector v = new Vector();
     byte[][] tuple = new byte[1][0];
-    f[0] = new Field(connection,new String("TABLE_SCHEM"),iVarcharOid,32);
+    f[0] = new Field(connection,"TABLE_SCHEM",iVarcharOid,32);
     tuple[0] = "".getBytes();
     v.addElement(tuple);
     return new ResultSet(connection,f,v,"OK",1);
@@ -1779,7 +1779,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     Field f[] = new Field[1];
     Vector v = new Vector();
     byte[][] tuple = new byte[1][0];
-    f[0] = new Field(connection,new String("TABLE_CAT"),iVarcharOid,32);
+    f[0] = new Field(connection,"TABLE_CAT",iVarcharOid,32);
     tuple[0] = "".getBytes();
     v.addElement(tuple);
     return new ResultSet(connection,f,v,"OK",1);
@@ -1867,24 +1867,24 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     java.sql.ResultSet r;      // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("TABLE_CAT"), iVarcharOid, 32);
-    f[1] = new Field(connection, new String("TABLE_SCHEM"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("TABLE_NAME"), iVarcharOid, 32);
-    f[3] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
-    f[4] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
-    f[5] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
-    f[6] = new Field(connection, new String("COLUMN_SIZE"), iInt4Oid, 4);
-    f[7] = new Field(connection, new String("BUFFER_LENGTH"), iVarcharOid, 32);
-    f[8] = new Field(connection, new String("DECIMAL_DIGITS"), iInt4Oid, 4);
-    f[9] = new Field(connection, new String("NUM_PREC_RADIX"), iInt4Oid, 4);
-    f[10] = new Field(connection, new String("NULLABLE"), iInt4Oid, 4);
-    f[11] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
-    f[12] = new Field(connection, new String("COLUMN_DEF"), iVarcharOid, 32);
-    f[13] = new Field(connection, new String("SQL_DATA_TYPE"), iInt4Oid, 4);
-    f[14] = new Field(connection, new String("SQL_DATETIME_SUB"), iInt4Oid, 4);
-    f[15] = new Field(connection, new String("CHAR_OCTET_LENGTH"), iVarcharOid, 32);
-    f[16] = new Field(connection, new String("ORDINAL_POSITION"), iInt4Oid,4);
-    f[17] = new Field(connection, new String("IS_NULLABLE"), iVarcharOid, 32);
+    f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, 32);
+    f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
+    f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
+    f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+    f[4] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+    f[5] = new Field(connection, "TYPE_NAME", iVarcharOid, 32);
+    f[6] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
+    f[7] = new Field(connection, "BUFFER_LENGTH", iVarcharOid, 32);
+    f[8] = new Field(connection, "DECIMAL_DIGITS", iInt4Oid, 4);
+    f[9] = new Field(connection, "NUM_PREC_RADIX", iInt4Oid, 4);
+    f[10] = new Field(connection, "NULLABLE", iInt4Oid, 4);
+    f[11] = new Field(connection, "REMARKS", iVarcharOid, 32);
+    f[12] = new Field(connection, "COLUMN_DEF", iVarcharOid, 32);
+    f[13] = new Field(connection, "SQL_DATA_TYPE", iInt4Oid, 4);
+    f[14] = new Field(connection, "SQL_DATETIME_SUB", iInt4Oid, 4);
+    f[15] = new Field(connection, "CHAR_OCTET_LENGTH", iVarcharOid, 32);
+    f[16] = new Field(connection, "ORDINAL_POSITION", iInt4Oid,4);
+    f[17] = new Field(connection, "IS_NULLABLE", iVarcharOid, 32);
     
     // Added by Stefan Andreasen <stefan@linux.kapow.dk>
     // If the pattern are  null then set them to %
@@ -1999,14 +1999,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     else
       columnNamePattern=columnNamePattern.toLowerCase();
     
-    f[0] = new Field(connection,new String("TABLE_CAT"),iVarcharOid,32);
-    f[1] = new Field(connection,new String("TABLE_SCHEM"),iVarcharOid,32);
-    f[2] = new Field(connection,new String("TABLE_NAME"),iVarcharOid,32);
-    f[3] = new Field(connection,new String("COLUMN_NAME"),iVarcharOid,32);
-    f[4] = new Field(connection,new String("GRANTOR"),iVarcharOid,32);
-    f[5] = new Field(connection,new String("GRANTEE"),iVarcharOid,32);
-    f[6] = new Field(connection,new String("PRIVILEGE"),iVarcharOid,32);
-    f[7] = new Field(connection,new String("IS_GRANTABLE"),iVarcharOid,32);
+    f[0] = new Field(connection,"TABLE_CAT",iVarcharOid,32);
+    f[1] = new Field(connection,"TABLE_SCHEM",iVarcharOid,32);
+    f[2] = new Field(connection,"TABLE_NAME",iVarcharOid,32);
+    f[3] = new Field(connection,"COLUMN_NAME",iVarcharOid,32);
+    f[4] = new Field(connection,"GRANTOR",iVarcharOid,32);
+    f[5] = new Field(connection,"GRANTEE",iVarcharOid,32);
+    f[6] = new Field(connection,"PRIVILEGE",iVarcharOid,32);
+    f[7] = new Field(connection,"IS_GRANTABLE",iVarcharOid,32);
     
     // This is taken direct from the psql source
     java.sql.ResultSet r = connection.ExecSQL("SELECT relname, relacl FROM pg_class, pg_user WHERE ( relkind = 'r' OR relkind = 'i') and relname !~ '^pg_' and relname !~ '^xin[vx][0-9]+' and usesysid = relowner and relname like '"+table.toLowerCase()+"' ORDER BY relname");
@@ -2099,14 +2099,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     ResultSet r;       // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("SCOPE"), iInt2Oid, 2);
-    f[1] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
-    f[3] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
-    f[4] = new Field(connection, new String("COLUMN_SIZE"), iInt4Oid, 4);
-    f[5] = new Field(connection, new String("BUFFER_LENGTH"), iInt4Oid, 4);
-    f[6] = new Field(connection, new String("DECIMAL_DIGITS"), iInt2Oid, 2);
-    f[7] = new Field(connection, new String("PSEUDO_COLUMN"), iInt2Oid, 2);
+    f[0] = new Field(connection, "SCOPE", iInt2Oid, 2);
+    f[1] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+    f[2] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+    f[3] = new Field(connection, "TYPE_NAME", iVarcharOid, 32);
+    f[4] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
+    f[5] = new Field(connection, "BUFFER_LENGTH", iInt4Oid, 4);
+    f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2);
+    f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2);
     
     return new ResultSet(connection, f, v, "OK", 1);
   }
@@ -2412,24 +2412,24 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
       ResultSet r;     // ResultSet for the SQL query that we need to do
       Vector v = new Vector();         // The new ResultSet tuple stuff
       
-      f[0] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
-      f[1] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
-      f[2] = new Field(connection, new String("PRECISION"), iInt4Oid, 4);
-      f[3] = new Field(connection, new String("LITERAL_PREFIX"), iVarcharOid, 32);
-      f[4] = new Field(connection, new String("LITERAL_SUFFIX"), iVarcharOid, 32);
-      f[5] = new Field(connection, new String("CREATE_PARAMS"), iVarcharOid, 32);
-      f[6] = new Field(connection, new String("NULLABLE"), iInt2Oid, 2);
-      f[7] = new Field(connection, new String("CASE_SENSITIVE"), iBoolOid, 1);
-      f[8] = new Field(connection, new String("SEARCHABLE"), iInt2Oid, 2);
-      f[9] = new Field(connection, new String("UNSIGNED_ATTRIBUTE"), iBoolOid, 1);
-      f[10] = new Field(connection, new String("FIXED_PREC_SCALE"), iBoolOid, 1);
-      f[11] = new Field(connection, new String("AUTO_INCREMENT"), iBoolOid, 1);
-      f[12] = new Field(connection, new String("LOCAL_TYPE_NAME"), iVarcharOid, 32);
-      f[13] = new Field(connection, new String("MINIMUM_SCALE"), iInt2Oid, 2);
-      f[14] = new Field(connection, new String("MAXIMUM_SCALE"), iInt2Oid, 2);
-      f[15] = new Field(connection, new String("SQL_DATA_TYPE"), iInt4Oid, 4);
-      f[16] = new Field(connection, new String("SQL_DATETIME_SUB"), iInt4Oid, 4);
-      f[17] = new Field(connection, new String("NUM_PREC_RADIX"), iInt4Oid, 4);
+      f[0] = new Field(connection, "TYPE_NAME", iVarcharOid, 32);
+      f[1] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+      f[2] = new Field(connection, "PRECISION", iInt4Oid, 4);
+      f[3] = new Field(connection, "LITERAL_PREFIX", iVarcharOid, 32);
+      f[4] = new Field(connection, "LITERAL_SUFFIX", iVarcharOid, 32);
+      f[5] = new Field(connection, "CREATE_PARAMS", iVarcharOid, 32);
+      f[6] = new Field(connection, "NULLABLE", iInt2Oid, 2);
+      f[7] = new Field(connection, "CASE_SENSITIVE", iBoolOid, 1);
+      f[8] = new Field(connection, "SEARCHABLE", iInt2Oid, 2);
+      f[9] = new Field(connection, "UNSIGNED_ATTRIBUTE", iBoolOid, 1);
+      f[10] = new Field(connection, "FIXED_PREC_SCALE", iBoolOid, 1);
+      f[11] = new Field(connection, "AUTO_INCREMENT", iBoolOid, 1);
+      f[12] = new Field(connection, "LOCAL_TYPE_NAME", iVarcharOid, 32);
+      f[13] = new Field(connection, "MINIMUM_SCALE", iInt2Oid, 2);
+      f[14] = new Field(connection, "MAXIMUM_SCALE", iInt2Oid, 2);
+      f[15] = new Field(connection, "SQL_DATA_TYPE", iInt4Oid, 4);
+      f[16] = new Field(connection, "SQL_DATETIME_SUB", iInt4Oid, 4);
+      f[17] = new Field(connection, "NUM_PREC_RADIX", iInt4Oid, 4);
       
       // cache some results, this will keep memory useage down, and speed
       // things up a little.
@@ -2522,19 +2522,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     ResultSet r;       // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("TABLE_CAT"), iVarcharOid, 32);
-    f[1] = new Field(connection, new String("TABLE_SCHEM"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("TABLE_NAME"), iVarcharOid, 32);
-    f[3] = new Field(connection, new String("NON_UNIQUE"), iBoolOid, 1);
-    f[4] = new Field(connection, new String("INDEX_QUALIFIER"), iVarcharOid, 32);
-    f[5] = new Field(connection, new String("INDEX_NAME"), iVarcharOid, 32);
-    f[6] = new Field(connection, new String("TYPE"), iInt2Oid, 2);
-    f[7] = new Field(connection, new String("ORDINAL_POSITION"), iInt2Oid, 2);
-    f[8] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
-    f[9] = new Field(connection, new String("ASC_OR_DESC"), iVarcharOid, 32);
-    f[10] = new Field(connection, new String("CARDINALITY"), iInt4Oid, 4);
-    f[11] = new Field(connection, new String("PAGES"), iInt4Oid, 4);
-    f[12] = new Field(connection, new String("FILTER_CONDITION"), iVarcharOid, 32);
+    f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, 32);
+    f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
+    f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
+    f[3] = new Field(connection, "NON_UNIQUE", iBoolOid, 1);
+    f[4] = new Field(connection, "INDEX_QUALIFIER", iVarcharOid, 32);
+    f[5] = new Field(connection, "INDEX_NAME", iVarcharOid, 32);
+    f[6] = new Field(connection, "TYPE", iInt2Oid, 2);
+    f[7] = new Field(connection, "ORDINAL_POSITION", iInt2Oid, 2);
+    f[8] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+    f[9] = new Field(connection, "ASC_OR_DESC", iVarcharOid, 32);
+    f[10] = new Field(connection, "CARDINALITY", iInt4Oid, 4);
+    f[11] = new Field(connection, "PAGES", iInt4Oid, 4);
+    f[12] = new Field(connection, "FILTER_CONDITION", iVarcharOid, 32);
     
     return new ResultSet(connection, f, v, "OK", 1);
   }
index 9c7025136db066c3c671d0cfe7768c05720f9213..3b30d0a2f92a1be1ea207b6a83237913a441fc8c 100644 (file)
@@ -161,7 +161,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getDatabaseProductName() throws SQLException
   {
-    return new String("PostgreSQL");
+    return "PostgreSQL";
   }
   
   /**
@@ -191,7 +191,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getDriverName() throws SQLException
   {
-    return new String("PostgreSQL Native Driver");
+    return "PostgreSQL Native Driver";
   }
   
   /**
@@ -203,7 +203,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getDriverVersion() throws SQLException
   {
-    return new String(Integer.toString(connection.this_driver.getMajorVersion())+"."+Integer.toString(connection.this_driver.getMinorVersion()));
+    return Integer.toString(connection.this_driver.getMajorVersion())+"."+Integer.toString(connection.this_driver.getMinorVersion());
   }
   
   /**
@@ -384,7 +384,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getSQLKeywords() throws SQLException
   {
-    return new String("abort,acl,add,aggregate,append,archive,arch_store,backward,binary,change,cluster,copy,database,delimiters,do,extend,explain,forward,heavy,index,inherits,isnull,light,listen,load,merge,nothing,notify,notnull,oids,purge,rename,replace,retrieve,returns,rule,recipe,setof,stdin,stdout,store,vacuum,verbose,version");
+    return "abort,acl,add,aggregate,append,archive,arch_store,backward,binary,change,cluster,copy,database,delimiters,do,extend,explain,forward,heavy,index,inherits,isnull,light,listen,load,merge,nothing,notify,notnull,oids,purge,rename,replace,retrieve,returns,rule,recipe,setof,stdin,stdout,store,vacuum,verbose,version";
   }
   
   public String getNumericFunctions() throws SQLException
@@ -420,7 +420,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getSearchStringEscape() throws SQLException
   {
-    return new String("\\");
+    return "\\";
   }
   
   /**
@@ -436,7 +436,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getExtraNameCharacters() throws SQLException
   {
-    return new String("");
+    return "";
   }
   
   /**
@@ -773,7 +773,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getSchemaTerm() throws SQLException
   {
-    return new String("Schema");
+    return "Schema";
   }
   
   /**
@@ -785,7 +785,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getProcedureTerm() throws SQLException
   {
-    return new String("Procedure");
+    return "Procedure";
   }
   
   /**
@@ -797,7 +797,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
    */
   public String getCatalogTerm() throws SQLException
   {
-    return new String("Catalog");
+    return "Catalog";
   }
   
   /**
@@ -823,7 +823,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
   public String getCatalogSeparator() throws SQLException
   {
     // PM Sep 29 97 - changed from "." as we don't support catalogs.
-    return new String("");
+    return "";
   }
   
   /**
@@ -1578,19 +1578,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     ResultSet r;       // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("PROCEDURE_CAT"), iVarcharOid, 32);
-    f[1] = new Field(connection, new String("PROCEDURE_SCHEM"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("PROCEDURE_NAME"), iVarcharOid, 32);
-    f[3] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
-    f[4] = new Field(connection, new String("COLUMN_TYPE"), iInt2Oid, 2);
-    f[5] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
-    f[6] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
-    f[7] = new Field(connection, new String("PRECISION"), iInt4Oid, 4);
-    f[8] = new Field(connection, new String("LENGTH"), iInt4Oid, 4);
-    f[9] = new Field(connection, new String("SCALE"), iInt2Oid, 2);
-    f[10] = new Field(connection, new String("RADIX"), iInt2Oid, 2);
-    f[11] = new Field(connection, new String("NULLABLE"), iInt2Oid, 2);
-    f[12] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
+    f[0] = new Field(connection, "PROCEDURE_CAT", iVarcharOid, 32);
+    f[1] = new Field(connection, "PROCEDURE_SCHEM", iVarcharOid, 32);
+    f[2] = new Field(connection, "PROCEDURE_NAME", iVarcharOid, 32);
+    f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+    f[4] = new Field(connection, "COLUMN_TYPE", iInt2Oid, 2);
+    f[5] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+    f[6] = new Field(connection, "TYPE_NAME", iVarcharOid, 32);
+    f[7] = new Field(connection, "PRECISION", iInt4Oid, 4);
+    f[8] = new Field(connection, "LENGTH", iInt4Oid, 4);
+    f[9] = new Field(connection, "SCALE", iInt2Oid, 2);
+    f[10] = new Field(connection, "RADIX", iInt2Oid, 2);
+    f[11] = new Field(connection, "NULLABLE", iInt2Oid, 2);
+    f[12] = new Field(connection, "REMARKS", iVarcharOid, 32);
     
     // add query loop here
     
@@ -1644,11 +1644,11 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     java.sql.ResultSet r;      // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("TABLE_CAT"), iVarcharOid, 32);
-    f[1] = new Field(connection, new String("TABLE_SCHEM"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("TABLE_NAME"), iVarcharOid, 32);
-    f[3] = new Field(connection, new String("TABLE_TYPE"), iVarcharOid, 32);
-    f[4] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
+    f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, 32);
+    f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
+    f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
+    f[3] = new Field(connection, "TABLE_TYPE", iVarcharOid, 32);
+    f[4] = new Field(connection, "REMARKS", iVarcharOid, 32);
     
     // Now form the query
     StringBuffer sql = new StringBuffer("select relname,oid,relkind from pg_class where (");
@@ -1755,7 +1755,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     Field f[] = new Field[1];
     Vector v = new Vector();
     byte[][] tuple = new byte[1][0];
-    f[0] = new Field(connection,new String("TABLE_SCHEM"),iVarcharOid,32);
+    f[0] = new Field(connection,"TABLE_SCHEM",iVarcharOid,32);
     tuple[0] = "".getBytes();
     v.addElement(tuple);
     return new ResultSet(connection,f,v,"OK",1);
@@ -1779,7 +1779,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     Field f[] = new Field[1];
     Vector v = new Vector();
     byte[][] tuple = new byte[1][0];
-    f[0] = new Field(connection,new String("TABLE_CAT"),iVarcharOid,32);
+    f[0] = new Field(connection,"TABLE_CAT",iVarcharOid,32);
     tuple[0] = "".getBytes();
     v.addElement(tuple);
     return new ResultSet(connection,f,v,"OK",1);
@@ -1867,24 +1867,24 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     java.sql.ResultSet r;      // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("TABLE_CAT"), iVarcharOid, 32);
-    f[1] = new Field(connection, new String("TABLE_SCHEM"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("TABLE_NAME"), iVarcharOid, 32);
-    f[3] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
-    f[4] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
-    f[5] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
-    f[6] = new Field(connection, new String("COLUMN_SIZE"), iInt4Oid, 4);
-    f[7] = new Field(connection, new String("BUFFER_LENGTH"), iVarcharOid, 32);
-    f[8] = new Field(connection, new String("DECIMAL_DIGITS"), iInt4Oid, 4);
-    f[9] = new Field(connection, new String("NUM_PREC_RADIX"), iInt4Oid, 4);
-    f[10] = new Field(connection, new String("NULLABLE"), iInt4Oid, 4);
-    f[11] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
-    f[12] = new Field(connection, new String("COLUMN_DEF"), iVarcharOid, 32);
-    f[13] = new Field(connection, new String("SQL_DATA_TYPE"), iInt4Oid, 4);
-    f[14] = new Field(connection, new String("SQL_DATETIME_SUB"), iInt4Oid, 4);
-    f[15] = new Field(connection, new String("CHAR_OCTET_LENGTH"), iVarcharOid, 32);
-    f[16] = new Field(connection, new String("ORDINAL_POSITION"), iInt4Oid,4);
-    f[17] = new Field(connection, new String("IS_NULLABLE"), iVarcharOid, 32);
+    f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, 32);
+    f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
+    f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
+    f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+    f[4] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+    f[5] = new Field(connection, "TYPE_NAME", iVarcharOid, 32);
+    f[6] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
+    f[7] = new Field(connection, "BUFFER_LENGTH", iVarcharOid, 32);
+    f[8] = new Field(connection, "DECIMAL_DIGITS", iInt4Oid, 4);
+    f[9] = new Field(connection, "NUM_PREC_RADIX", iInt4Oid, 4);
+    f[10] = new Field(connection, "NULLABLE", iInt4Oid, 4);
+    f[11] = new Field(connection, "REMARKS", iVarcharOid, 32);
+    f[12] = new Field(connection, "COLUMN_DEF", iVarcharOid, 32);
+    f[13] = new Field(connection, "SQL_DATA_TYPE", iInt4Oid, 4);
+    f[14] = new Field(connection, "SQL_DATETIME_SUB", iInt4Oid, 4);
+    f[15] = new Field(connection, "CHAR_OCTET_LENGTH", iVarcharOid, 32);
+    f[16] = new Field(connection, "ORDINAL_POSITION", iInt4Oid,4);
+    f[17] = new Field(connection, "IS_NULLABLE", iVarcharOid, 32);
     
     // Added by Stefan Andreasen <stefan@linux.kapow.dk>
     // If the pattern are  null then set them to %
@@ -1999,14 +1999,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     else
       columnNamePattern=columnNamePattern.toLowerCase();
     
-    f[0] = new Field(connection,new String("TABLE_CAT"),iVarcharOid,32);
-    f[1] = new Field(connection,new String("TABLE_SCHEM"),iVarcharOid,32);
-    f[2] = new Field(connection,new String("TABLE_NAME"),iVarcharOid,32);
-    f[3] = new Field(connection,new String("COLUMN_NAME"),iVarcharOid,32);
-    f[4] = new Field(connection,new String("GRANTOR"),iVarcharOid,32);
-    f[5] = new Field(connection,new String("GRANTEE"),iVarcharOid,32);
-    f[6] = new Field(connection,new String("PRIVILEGE"),iVarcharOid,32);
-    f[7] = new Field(connection,new String("IS_GRANTABLE"),iVarcharOid,32);
+    f[0] = new Field(connection,"TABLE_CAT",iVarcharOid,32);
+    f[1] = new Field(connection,"TABLE_SCHEM",iVarcharOid,32);
+    f[2] = new Field(connection,"TABLE_NAME",iVarcharOid,32);
+    f[3] = new Field(connection,"COLUMN_NAME",iVarcharOid,32);
+    f[4] = new Field(connection,"GRANTOR",iVarcharOid,32);
+    f[5] = new Field(connection,"GRANTEE",iVarcharOid,32);
+    f[6] = new Field(connection,"PRIVILEGE",iVarcharOid,32);
+    f[7] = new Field(connection,"IS_GRANTABLE",iVarcharOid,32);
     
     // This is taken direct from the psql source
     java.sql.ResultSet r = connection.ExecSQL("SELECT relname, relacl FROM pg_class, pg_user WHERE ( relkind = 'r' OR relkind = 'i') and relname !~ '^pg_' and relname !~ '^xin[vx][0-9]+' and usesysid = relowner and relname like '"+table.toLowerCase()+"' ORDER BY relname");
@@ -2099,14 +2099,14 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     ResultSet r;       // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("SCOPE"), iInt2Oid, 2);
-    f[1] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
-    f[3] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
-    f[4] = new Field(connection, new String("COLUMN_SIZE"), iInt4Oid, 4);
-    f[5] = new Field(connection, new String("BUFFER_LENGTH"), iInt4Oid, 4);
-    f[6] = new Field(connection, new String("DECIMAL_DIGITS"), iInt2Oid, 2);
-    f[7] = new Field(connection, new String("PSEUDO_COLUMN"), iInt2Oid, 2);
+    f[0] = new Field(connection, "SCOPE", iInt2Oid, 2);
+    f[1] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+    f[2] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+    f[3] = new Field(connection, "TYPE_NAME", iVarcharOid, 32);
+    f[4] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
+    f[5] = new Field(connection, "BUFFER_LENGTH", iInt4Oid, 4);
+    f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2);
+    f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2);
     
     return new ResultSet(connection, f, v, "OK", 1);
   }
@@ -2412,24 +2412,24 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
       ResultSet r;     // ResultSet for the SQL query that we need to do
       Vector v = new Vector();         // The new ResultSet tuple stuff
       
-      f[0] = new Field(connection, new String("TYPE_NAME"), iVarcharOid, 32);
-      f[1] = new Field(connection, new String("DATA_TYPE"), iInt2Oid, 2);
-      f[2] = new Field(connection, new String("PRECISION"), iInt4Oid, 4);
-      f[3] = new Field(connection, new String("LITERAL_PREFIX"), iVarcharOid, 32);
-      f[4] = new Field(connection, new String("LITERAL_SUFFIX"), iVarcharOid, 32);
-      f[5] = new Field(connection, new String("CREATE_PARAMS"), iVarcharOid, 32);
-      f[6] = new Field(connection, new String("NULLABLE"), iInt2Oid, 2);
-      f[7] = new Field(connection, new String("CASE_SENSITIVE"), iBoolOid, 1);
-      f[8] = new Field(connection, new String("SEARCHABLE"), iInt2Oid, 2);
-      f[9] = new Field(connection, new String("UNSIGNED_ATTRIBUTE"), iBoolOid, 1);
-      f[10] = new Field(connection, new String("FIXED_PREC_SCALE"), iBoolOid, 1);
-      f[11] = new Field(connection, new String("AUTO_INCREMENT"), iBoolOid, 1);
-      f[12] = new Field(connection, new String("LOCAL_TYPE_NAME"), iVarcharOid, 32);
-      f[13] = new Field(connection, new String("MINIMUM_SCALE"), iInt2Oid, 2);
-      f[14] = new Field(connection, new String("MAXIMUM_SCALE"), iInt2Oid, 2);
-      f[15] = new Field(connection, new String("SQL_DATA_TYPE"), iInt4Oid, 4);
-      f[16] = new Field(connection, new String("SQL_DATETIME_SUB"), iInt4Oid, 4);
-      f[17] = new Field(connection, new String("NUM_PREC_RADIX"), iInt4Oid, 4);
+      f[0] = new Field(connection, "TYPE_NAME", iVarcharOid, 32);
+      f[1] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
+      f[2] = new Field(connection, "PRECISION", iInt4Oid, 4);
+      f[3] = new Field(connection, "LITERAL_PREFIX", iVarcharOid, 32);
+      f[4] = new Field(connection, "LITERAL_SUFFIX", iVarcharOid, 32);
+      f[5] = new Field(connection, "CREATE_PARAMS", iVarcharOid, 32);
+      f[6] = new Field(connection, "NULLABLE", iInt2Oid, 2);
+      f[7] = new Field(connection, "CASE_SENSITIVE", iBoolOid, 1);
+      f[8] = new Field(connection, "SEARCHABLE", iInt2Oid, 2);
+      f[9] = new Field(connection, "UNSIGNED_ATTRIBUTE", iBoolOid, 1);
+      f[10] = new Field(connection, "FIXED_PREC_SCALE", iBoolOid, 1);
+      f[11] = new Field(connection, "AUTO_INCREMENT", iBoolOid, 1);
+      f[12] = new Field(connection, "LOCAL_TYPE_NAME", iVarcharOid, 32);
+      f[13] = new Field(connection, "MINIMUM_SCALE", iInt2Oid, 2);
+      f[14] = new Field(connection, "MAXIMUM_SCALE", iInt2Oid, 2);
+      f[15] = new Field(connection, "SQL_DATA_TYPE", iInt4Oid, 4);
+      f[16] = new Field(connection, "SQL_DATETIME_SUB", iInt4Oid, 4);
+      f[17] = new Field(connection, "NUM_PREC_RADIX", iInt4Oid, 4);
       
       // cache some results, this will keep memory useage down, and speed
       // things up a little.
@@ -2522,19 +2522,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
     ResultSet r;       // ResultSet for the SQL query that we need to do
     Vector v = new Vector();           // The new ResultSet tuple stuff
     
-    f[0] = new Field(connection, new String("TABLE_CAT"), iVarcharOid, 32);
-    f[1] = new Field(connection, new String("TABLE_SCHEM"), iVarcharOid, 32);
-    f[2] = new Field(connection, new String("TABLE_NAME"), iVarcharOid, 32);
-    f[3] = new Field(connection, new String("NON_UNIQUE"), iBoolOid, 1);
-    f[4] = new Field(connection, new String("INDEX_QUALIFIER"), iVarcharOid, 32);
-    f[5] = new Field(connection, new String("INDEX_NAME"), iVarcharOid, 32);
-    f[6] = new Field(connection, new String("TYPE"), iInt2Oid, 2);
-    f[7] = new Field(connection, new String("ORDINAL_POSITION"), iInt2Oid, 2);
-    f[8] = new Field(connection, new String("COLUMN_NAME"), iVarcharOid, 32);
-    f[9] = new Field(connection, new String("ASC_OR_DESC"), iVarcharOid, 32);
-    f[10] = new Field(connection, new String("CARDINALITY"), iInt4Oid, 4);
-    f[11] = new Field(connection, new String("PAGES"), iInt4Oid, 4);
-    f[12] = new Field(connection, new String("FILTER_CONDITION"), iVarcharOid, 32);
+    f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, 32);
+    f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
+    f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
+    f[3] = new Field(connection, "NON_UNIQUE", iBoolOid, 1);
+    f[4] = new Field(connection, "INDEX_QUALIFIER", iVarcharOid, 32);
+    f[5] = new Field(connection, "INDEX_NAME", iVarcharOid, 32);
+    f[6] = new Field(connection, "TYPE", iInt2Oid, 2);
+    f[7] = new Field(connection, "ORDINAL_POSITION", iInt2Oid, 2);
+    f[8] = new Field(connection, "COLUMN_NAME", iVarcharOid, 32);
+    f[9] = new Field(connection, "ASC_OR_DESC", iVarcharOid, 32);
+    f[10] = new Field(connection, "CARDINALITY", iInt4Oid, 4);
+    f[11] = new Field(connection, "PAGES", iInt4Oid, 4);
+    f[12] = new Field(connection, "FILTER_CONDITION", iVarcharOid, 32);
     
     return new ResultSet(connection, f, v, "OK", 1);
   }