On 5/21/15 11:15 AM, Bosco Rama wrote:
You could probably make some of that into a function that accepts a timestamptz and generates the two days.
You'll be better off if instead of 2 days it gives you a daterange: http://www.postgresql.org/docs/9.4/static/rangetypes.html
I don't know about the exact ISO details, but your approach is the correct one: find the date that the current week started on and then build a range of [week start, week start + 7 days).
Also, note the use of [ vs ). That is the ONLY correct way to do this if you're comparing to a timestamp.
-- Jim Nasby, Data Architect, Blue Treble Consulting Data in Trouble? Get it in Treble! http://BlueTreble.com -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance