We use $n_past-days instead of :n_past_days becasuse he pgdriver bind variable emulation puts single-quotes around the n_past_days integer. Postgresql tries to turn '-1' into a date datatype so now()-'-1' fails but now()- -1 works fine.
By Dave Bauer in the process of migrating the openacs.org site.