I have a query that works on Postgresql 7.4 but not on Postgresql 8.3 with same database.
SELECT * FROM login_session WHERE (now()-modified) > timeout;
Gets the following error:
ERROR: operator does not exist: interval > integer LINE 1: ...ELECT * FROM login_session WHERE (now()-modified) > timeout ... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
modified is a
timeout is an
Is there some settings I need to change on server?
I'm installing an application for a client on new server (ubuntu) so I can't change queries in the application.
AWStats SQL Tool?
How do I change a column's Format to Percent using a SQL in VBA?
ought to do it..
create or replace function int2interval (x integer) returns interval as $$ select $1*'1 sec'::interval $$ language sql; create cast (integer as interval) with function int2interval (integer) as implicit;
SSMS permits duplicate records in a table, but not subsequent updates
SQL 2008 Compression
I need help on INSERT command, two tables
Column Naming Advice
SQL delete from related tables
Some of the most drastic were the removal of some automatic casts..
Select a dummy column with a dummy value in SQL?
I suppose the "timeout" is in seconds? If so you could change the query to:.
SELECT * FROM login_session WHERE (CURRENT_TIMESTAMP - modified) > (timeout * '1 sec'::interval);
(Assuming timeout is measured in seconds - change accordingly otherwise).
CREATE OR REPLACE FUNCTION intToInterval(arg integer) RETURNS interval AS $BODY$ BEGIN return CAST( arg || ' seconds' AS interval ); END; $BODY$ LANGUAGE 'plpgsql'; CREATE CAST (integer AS interval) WITH FUNCTION intToInterval ( integer ) AS IMPLICIT;