CURRENT_TIMESTAMP not work correctly insinde a transaction.

Поиск
Список
Период
Сортировка
От Nicolas Paymal
Тема CURRENT_TIMESTAMP not work correctly insinde a transaction.
Дата
Msg-id LJEIJOMPNLMBFJLMFLKAMELJCAAA.npaymal@instranet.com
обсуждение исходный текст
Список pgsql-bugs
Hello
  I am using pgsql 7.1 and 7.2 and I found a bug When I use
CURRENT_TIMESTAMP in a sql query.
In a transaction until you commit your transaction through a jdbc
connection, each time you use the Current_timestamp (or 'now'), the
timestamps is always the same, and when your transaction is very long you
have undesirable effect.


I also would like to submit enhancement request, who can I contact or where
can I send e-mail ?

Thanks for you Help.

example of code :


import java.sql.*;

class test  {

   static private String driver = "org.postgresql.Driver";
   static private String url    =
"jdbc:postgresql://bela:5432/idb?compatible=7.1";

   static void main(String argv[]) {
      Connection con        = null;
      Statement  statement  = null;
      ResultSet  rset       = null;

      try {
         Class.forName(driver);
         con = DriverManager.getConnection(url, "iuser", "qa");
         statement = con.createStatement();
         con.setAutoCommit(false);
         int cpt;
         for (int i=0;i<5;i++) {
            rset = statement.executeQuery("SELECT CURRENT_TIMESTAMP AS
VAR");
            if (rset!=null && rset.next()) {
               java.sql.Timestamp ts = rset.getTimestamp("VAR");
               System.out.println(i + "  -> timestamp = "+ts);
            }
            Thread.sleep(1000);
         }

         con.commit();

         for (int i=0;i<5;i++) {
            rset = statement.executeQuery("SELECT CURRENT_TIMESTAMP AS
VAR");
            if (rset!=null && rset.next()) {
               java.sql.Timestamp ts = rset.getTimestamp("VAR");
               System.out.println((i+5) + "  -> timestamp = "+ts);
            }
            Thread.sleep(1000);
         }

         statement.close();
         con.close();
      } catch (Exception e) {
         System.out.println("# Problem: "+e);
         e.printStackTrace();
      }
   }
}

--
Nicolas Paymal
Developer R&D.
Instranet Inc.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Patch pgsql-7.2 AuthBlockSig
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: CURRENT_TIMESTAMP not work correctly insinde a transaction.