----- Original Message ----- From: "Omar Eljumaily" <[EMAIL PROTECTED]>
To: "Ted Byers" <[EMAIL PROTECTED]>
Cc: <pgsql-general@postgresql.org>
Sent: Friday, March 09, 2007 5:00 PM
Subject: Re: [GENERAL] Setting week starting day


Ted, my reason for asking the question that I believe precipitated this thread was that I wanted a single sql statement that aggregated time data by week. Yes, I could do the aggregation subsequently in my own client side code, but it's easier and less error prone to have it done by the server.

I don't buy the suggestion that server side code is less error prone that client side code, but be that as it may, we're talking about a function that has one line of code. And given what you just said, you don't want the day of the week, you want a function that returns the week of the year. This can be had from the same Perl functions I mentioned before, with a minor alteration in how you call it. my suggestion would be to create that one line function that invokes the relevant Perl function, which can then be invoked in your select statement (presumably with a group clause to avoid mixing data from different years). It should take about ten to fifteen minutes to write and test?

Ted


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to