Skip to content
Snippets Groups Projects
  1. Mar 05, 2002
  2. Feb 22, 2002
    • Dave Cramer's avatar
      Patch from Cormac Twomey · deaad934
      Dave Cramer authored
      fixes getIndexInfo throwing NullPointerException
      fixes getIndexInfo improper results when multiple key indexs are used
      deaad934
  3. Jan 18, 2002
  4. Nov 20, 2001
  5. Nov 19, 2001
  6. Nov 09, 2001
  7. Nov 03, 2001
  8. Oct 30, 2001
  9. Oct 25, 2001
  10. Oct 24, 2001
  11. Sep 29, 2001
    • Bruce Momjian's avatar
      Per the recent discussion there's been some code changes in JDBC's · 07ce9fe6
      Bruce Momjian authored
      DatabaseMetaData.getColumn(). I proposed a patch that would change the
      number of queries to find out all columns in a table from 2 * N + 1 to 1 (N
      being the number of columns reported) by using some outer joins. I also
      fixed the fact that getColumns() only returned columns that had a default
      defined. OTOH, I did not use to change the code required for obtaining a
      column's remarks (by using col_description() for 7.2  and requested by Tom
      Lane).
      
      Finally, I have found a way to get all the column details in a single query
      *and* use col_description() for 7.2 servers. A patch is attached. It
      overrules Ren? Pijlman's fix for this that was committed just today, but
      still used N + 1 queries (sorry Ren? ;-) )
      
      I also fixed the return values for TABLE_CAT and TABLE_SCHEM from "" to
      null, to be more standard compliant (and requested in Ren?'s mail found at
      http://fts.postgresql.org/db/mw/msg.html?mid=1034253).
      
      As always, the JDBC1 version has not been tested as I have no JDK 1.1
      
      Jeroen van Vianen
      07ce9fe6
  12. Sep 10, 2001
    • Bruce Momjian's avatar
      On Fri, 07 Sep 2001 01:34:46 -0400, Tom Lane wrote: · 6b50f9af
      Bruce Momjian authored
      >there is still an unpatched reference to pg_description in
      >getColumns(), in both jdbc1 and jdbc2.
      
      This was introduced by Jeroen's patch (see
      http://fts.postgresql.org/db/mw/msg.html?mid=1032468). Attached
      is a patch that returns getColumns() to using "select
      obj_description()" instead of direct access to pg_description,
      as per the request by Tom.
      
      I've incorporated Jeroen's fix to left outer join with
      pg_attrdef instead of inner join, so getColumns() also returns
      columns without a default value.
      
      I have, however, not included Jeroen's attempt to combine
      multiple queries into one huge multi-join query for better
      performance, because:
      1) I don't know how to do that using obj_description() instead
      of direct access to pg_description
      2) I don't think a performance improvement (if any) in this
      method is very important
      
      Because of the outer join, getColumns() will only work with a
      backend >= 7.1. Since the conditional coding for 7.1/7.2 and
      jdbc1/jdbc2 is already giving me headaches I didn't pursue a
      pre-7.1 solution.
      
      Regards,
      Ren? Pijlman <rene@lab.applinet.nl>
      6b50f9af
  13. Sep 06, 2001
    • Bruce Momjian's avatar
      > Patch applied. Thanks. · f57477e6
      Bruce Momjian authored
      Thanks. However, I seem to have left a single debug statement in there :-(
      
      Here's a patch to remove it.
      
      Vianen, Jeroen van
      f57477e6
    • Bruce Momjian's avatar
      Attached is a patch for JDBC's getColumn() function that was broken / · 57040f78
      Bruce Momjian authored
      flawed in the following ways:
      
      1. Only returned columns that had a default value defined, rather than all
      columns in a table
      2. Used 2 * N + 1 queries to find out attributes, comments and typenames
      for N columns.
      
      By using some outer join syntax it is possible to retrieve all necessary
      information in just one SQL statement. This means this version is only
      suitable for PostgreSQL >= 7.1. Don't know whether that's a problem.
      
      I've tested this function with current sources and 7.1.3 and patched both
      jdbc1 and jdbc2. I haven't compiled nor tested the jdbc1 version though, as
      I have no JDK 1.1 available.
      
      Note the discussion in http://fts.postgresql.org/db/mw/msg.html?mid=1029626
      regarding differences in obtaining comments on database object in 7.1 and
      7.2. I was unable to use the following syntax (or similar ones):
      
      select
           ...,
           description
      from
           ...
           left outer join col_description(a.attrelid, a.attnum) description
      order by
           c.relname, a.attnum;
      
      (the error was parse error at or near '(') so I had to paste the actual
      code for the col_description function into the left outer join. Maybe
      someone who is more knowledgable about outer joins might provide me with a
      better SQL statement.
      
      Jeroen van Vianen
      57040f78
  14. Aug 29, 2001
  15. Aug 24, 2001
    • Bruce Momjian's avatar
      Attached is a patch to fix the current issues with building under jdbc1. · 76a6da8a
      Bruce Momjian authored
        This patch moves the logic that looks up TypeOid, PGTypeName, and
      SQLTypeName from Field to Connection.  It is moved to connection since
      it needs to differ from the jdbc1 to jdbc2 versions and Connection
      already has different subclasses for the two driver versions.  It also
      made sense to move the logic to Connection as some of the logic was
      already there anyway.
      
      Barry Lind
      76a6da8a
  16. Aug 21, 2001
    • Bruce Momjian's avatar
      > · 44ae35ca
      Bruce Momjian authored
      > Shouldn't
      >
      >    throw new PSQLException("metadata unavailable");
      >
      > in getTypeInfo() be something like:
      >
      >    throw new PSQLException("postgresql.meta.unavailable");
      >
      > to allow translation of the error message in the
      > errors*.properties files?
      
      You're right. Attached is an updated patch that also includes a message
      in error.properties. I've attempted a French message in
      errors_fr.properties but beware that I haven't written French in quite a
      few years. Don't know Italian, German, or Dutch so I can't do those.
      
      Liam Stewart
      44ae35ca
  17. Aug 17, 2001
    • Bruce Momjian's avatar
      This patch updates some comments in the DatabaseMetaData classes to · 95504094
      Bruce Momjian authored
      reflect a mail thread that discussed our conformance (or lack thereof)
      to the SQL92 spec.
      
      Barry Lind
      95504094
    • Bruce Momjian's avatar
      Attached is the patch requested by Tom Lane (see below). It · 1ebbfc15
      Bruce Momjian authored
      includes two changes in the JDBC driver:
      
      1) When connected to a backend >= 7.2: use obj_description() and
      col_description() instead of direct access to pg_description.
      
      2) In DatabaseMetaData.getTables()/getColumns()/getProcedures():
      when there is no comment on the object, return null in the
      REMARKS column of the ResultSet, instead of the default string
      "no remarks".
      
      Change 2 first appeared as a side-effect of change 1, but it is
      actually more compliant with the JDBC spec: "String object
      containing an explanatory comment on the table/column/procedure,
      which may be null". The default string "no remarks" was strictly
      speaking incorrect, as it could not be distinguished from a real
      user comment "no remarks". So I removed the default string
      completely.
      
      Change 2 might break existing code that doesn't follow the JDBC
      spec and isn't prepared to handle a null in the REMARKS column
      of getTables()/getColumns()/getProcedures.
      
      Patch tested with jdbc2 against both a 7.1 and a CVS tip
      backend. I did not have a jdbc1 environment to build and test
      with, but since the touched code is identical in jdbc1 and jdbc2
      I don't foresee any problems.
      
      Regards,
      Ren? Pijlman
      1ebbfc15
  18. Aug 04, 2001
    • Bruce Momjian's avatar
      Attached is a patch that does the following: · 184505bb
      Bruce Momjian authored
      1) improves performance of commit/rollback by reducing number of round
      trips to the server
      2) uses 7.1 functionality for setting the transaction isolation level
      3) backs out a patch from 11 days ago because that code failed to
      compile under jdk1.1
      
      Details:
      
      1)  The old code was doing the following for each commit:
         commit
         begin
         set transaction isolation level xxx
      thus a call to commit was performing three round trips to the database.
        The new code does this in one round trip as:
         commit; begin; set transaction isolation level xxx
      
      In a simple test program that performs 1000 transactions (where each
      transaction does one simple select inside that transaction) has the
      following before and after timings:
      
      Client and Server on same machine
      
      old         new
      ---         ---
      1.877sec    1.405sec   25.1% improvement
      
      Client and Server on different machines
      old         new
      ---         ---
      4.184sec    2.927sec   34.3% improvement
      
      (all timings are an average of four different runs)
      
      
      2)  The driver was using 'set transaction isolation level xxx' at the
      begining of each transaction, instead of using the new 7.1 syntax of
      'set session characteristics as transaction isolation level xxx' which
      only needs to be done once instead of for each transaction.  This is
      done conditionally (i.e. if server is 7.0 or older do the old behaviour,
      else do the new behaviour) to not break backward compatibility.  This
      also required the movement of some code to check/test database version
      numbers from the DatabaseMetaData object to the Connection object.
      
      3) Finally while testing, I discovered that the code that was checked in
        11 days ago actually didn't compile.  The code in the patch for
      Connection.setCatalog() used Properties.setProperty() which only exists
      in JDK1.2 or higher.  Thus compiling the JDBC1 driver failed as this
      method doesn't exist.  Thus I backed out that patch.
      
      
      Barry Lind
      184505bb
  19. Jul 21, 2001
  20. Jul 08, 2001
    • Peter Eisentraut's avatar
      b054fb3b
    • Peter Eisentraut's avatar
      Bring DatabaseMetaData feature tests up to date: · 2d9ee0fc
      Peter Eisentraut authored
      * NULLs are sorted differently in 7.2
      * table correlation names are supported
      * GROUP BY, ORDER BY unrelated is supported since 6.4
      * ESCAPE/LIKE only supported since 7.1
      * outer joins only since 7.1
      * preferred term for procedure is "function"
      * preferred term for catalog is "database"
      * supports SELECT for UPDATE since 6.5
      * supports subqueries
      * supports UNION; supports UNION ALL since 7.1
      * update some of the max lengths to match reality
      * rearrange some functions to match the order in the spec
        for easier maintenance
      2d9ee0fc
  21. Jul 07, 2001
  22. May 30, 2001
  23. May 17, 2001
    • Bruce Momjian's avatar
    • Bruce Momjian's avatar
      Cleanup of backpatch of jdbc2 improvements to jdbc1: · 2e3c56a0
      Bruce Momjian authored
      Here's what I came up with. The biggest difference api between JDK1.x and
      later versions is the support for collections. The problem was with the
      Vector class; in jdk1.x there is no method called add, so I changed the
      calls to addElement. Also no addAll, so I rewrote the method slightly to not
      require addAll. While reviewing this I notices some System.out.println
      statements that weren't commented out. So I commented them out in both
      versions.
      
      The upshot of all of this is that I have clean compile, but no idea if the
      code works ;(
      
      Dave Cramer
      2e3c56a0
  24. May 16, 2001
  25. Feb 09, 2001
  26. Jan 24, 2001
  27. Nov 25, 2000
  28. Oct 12, 2000
  29. Oct 09, 2000
  30. Oct 08, 2000
    • Bruce Momjian's avatar
      Okay, I have some new code in place that hopefully should work better. I · 5383b5d8
      Bruce Momjian authored
      couldn't produce a full patch using cvs diff -c this time since I have
      created new files and anonymous cvs usage doesn't allow you to
      adds. I'm supplying the modified src/interfaces/jdbc as a tarball at :
      http://www.candleweb.no/~gunnar/projects/pgsql/postgres-jdbc-2000-10-05.tgz
      
      The new files that should be added are :
      
      ? org/postgresql/PGStatement.java
      ? org/postgresql/ObjectPool.java
      ? org/postgresql/ObjectPoolFactory.java
      
      There is now a global static pool of free byte arrays and used byte arrays
      connected to a statement object. This is the role of the new PGStatement
      class. Access to the global free array is synchronized, while we rely on
      the PG_Stream synchronization for the used array.
      
      My measurements show that the perfomance boost on this code is not quite as
      big as my last shot, but it is still an improvement. Maybe some of the
      difference is due to the new synchronization on the global array. I think I
      will look into choosing between on a connection level and global level.
      
      I have also started experimented with improving the performance of the
      various conversions. The problem here is ofcourse related handle the
      various encodings. One thing I found to speed up ResultSet.getInt() a lot
      was to do custom conversion on the byte array into int instead of going
      through the getString() to do the conversion. But I'm unsure if this is
      portable, can we assume that a digit never can be represented by more than
      one byte ? It works fine in my iso-latin-8859-1 environment, but what about
      other environments ? Maybe we could provide different ResultSet
      implementations depending on the encoding used or delegate some methods of
      the result set to an "converter class".
      
      Check the org/postgresql/jdbc2/FastResultSet.java in the tarball above to
      see the modified getInt() method.
      
      Regards,
      
              Gunnar
      5383b5d8
  31. Sep 12, 2000
    • Bruce Momjian's avatar
      As if my JDBC patch hasn't already caused enough grief, there is now a · 339ce34b
      Bruce Momjian authored
      one-line change necessary. Due to the Mark Holloman "New Relkind for
      Views" patch, my support for views in the driver will need to be updated
      to match. The change to DatabaseMetaData.getTableTypes[][] is as
      follows:
      
      -    {"VIEW",           "(relkind='r' and relhasrules='t' and relname !~
      '^pg_' and relname !~ '^xinv')"},
      +    {"VIEW",           "(relkind='v' and relname !~ '^pg_' and relname
      !~ '^xinv')"},
      
      Christopher Cain
      339ce34b
    • Bruce Momjian's avatar
      This patch implements the following command: · 7f171b59
      Bruce Momjian authored
      ALTER TABLE <tablename> OWNER TO <username>
      
      Only a superuser may execute the command.
      
      --
      Mark Hollomon
      mhh@mindspring.com
      7f171b59
Loading