Hi Everyone, I have a table named concurrent_user which has a column time_stamp.
The column stores the timestamp for the latest entered record. My query finds the difference of the timestamp from the
current time, if the value is larger than 5 minutes then the latest entered
record in the table is assigned to a new user if he tries through the
application else he is displayed an error message. The thing worked fine while the database was on Oracle but
since migrating it to postgres it is not able to handle the conversion. The query is something like : DELETE from CONCURRENT_USER WHERE (now() -
CONCURRENT_USER.TIME_STAMP) > ? Here the calculated value in ‘?’ is not supported
by the postgres as it was set as a double. I tried to cast it to a timestamp by using Timestamp
timestamp = new Timestamp((java.sql.Date(rs.getTimestamp(time_stamp)).getTime()); But then it started to give : ...... <Exception Message> : ERROR: invalid input
syntax for type interval: "1970-01-01 01:05:00.000000 +01:00:00" - org.postgresql.util.PSQLException: ERROR: invalid input
syntax for type interval: "1970-01-01 01:05:00.000000 +01:00:00" org.postgresql.util.PSQLException: ERROR: invalid input
syntax for type interval: "1970-01-01 01:05:00.000000 +01:00:00" at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548) at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316) at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:305) at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95) at
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251) Kindly help for the same Regards, Kapil |