From: | "Nicolas Paymal" <npaymal(at)instranet(dot)com> |
---|---|
To: | <pgsql-bugs(at)postgresql(dot)org> |
Subject: | CURRENT_TIMESTAMP not work correctly insinde a transaction. |
Date: | 2002-02-22 13:38:53 |
Message-ID: | LJEIJOMPNLMBFJLMFLKAMELJCAAA.npaymal@instranet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-02-22 15:10:53 | Re: my pl/pgsql functions return weird results |
Previous Message | Andy Marden | 2002-02-22 12:17:59 | Re: Full bug list |