Bruce Momjian wrote: > Why would you want an abolute value of a negative interval?
Because I'm trying to match pairs of records that satisfy certain criteria, one of which is that both records have a timestamp that *may* be slightly offset between them, so I substract the two and the result must be no greater than the allowed offset. I don't know which record has the greater timestamp, so I don't know the sign of the substraction in advance. > > This works: > > test=> select -(interval '-1'); > ?column? > ---------- > 01:00:00 > (1 row) > > so I suppose you could create a function or CASE statement to get the > absolute value. > In the meantime I implemented it the following way: \set maxoffset 4 select ... where abs(extract(epoch from age(m1.ts, m2.ts))) < :maxoffset ... Which I think is more compact. Anyway, it would be nice to be able to write directly abs(age(m1.ts, m2.ts)) IMHO. thanks cl. ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend