Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> I think something like:
> (CASE WHEN extract(dow from date) = 0 THEN 7 else extract(dow from date))
It's really not that hard:
(extract(dow from date) + 6) % 7
You can rotate to any week-start day you like by substituting different
things for "6".
regards, tom lane