Re: [SQL] date arithmetic with columns

2012-03-03 Thread Pavel Stehule
Hello 2012/3/1 Peter Faulks : > Bit more googling and I came up with: > > r.utc + CAST( tz.diffmins || ' ' || 'minutes' AS interval) > > It works, but is it the best way? > r.utc + tz.diffmins * interval '1 minute' regards Pavel Stehule > > On 1/03/2012 6:50 AM, Peter Faulks wrote: >> >> I ha

Re: [SQL] Problems with ODBC connections

2012-03-03 Thread Sandeep Reddy
Hi, The Error message is like this "Could not connect to server; A connection attempt failed because the connected party did not properly respond after a periord..." I have run postgres with option -i and changed the pg_hba.conf the IPv4 details to 0.0.0.0.0/0 to accept form all clients still

[SQL] Problems with non use of indexes

2012-03-03 Thread tylersti...@gmail.com
Hi, I can't figure out why query planner doesn't use the proper index, anyone can help me? This query properly uses indexes: mydb=# EXPLAIN SELECT U0."object_id" FROM "activity_follow" U0 WHERE (U0."content_type_id" = 3 AND U0."user_id" = 1); QUERY PLAN

Re: [SQL] date arithmetic with columns

2012-03-03 Thread Peter Faulks
Bit more googling and I came up with: r.utc + CAST( tz.diffmins || ' ' || 'minutes' AS interval) It works, but is it the best way? On 1/03/2012 6:50 AM, Peter Faulks wrote: I have two columns in two distinct tables, one is the starting time of an event, timestamp without time zone. Data is the

[SQL] date arithmetic with columns

2012-03-03 Thread Peter Faulks
I have two columns in two distinct tables, one is the starting time of an event, timestamp without time zone. Data is the utc datetime (for sorting across time zones), the other is the number of minutes to add. I am migrating from Firebird. One of the queries uses the dateadd function to build