One Quickie

pg interval math (Postgresql->General)
Older versions of pg would support select blah from whatever where date-column > (current_timestamp - 21) to get all the blahs from whatever in the last 21 days. This doesn't work in newer versions of Postgresql. Instead, you need to use a time interval:
select to_char (whenx, 'fmDD fmMonth YYYY') as pretty_when, text
  from blog
 where whenx > (current_timestamp - interval '21 days')
 order by whenx desc

borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book