> By making this function sql and immutable, you give the database more
> ability to inline it into queries which can make a tremendous
> performance difference in some cases. You can also index based on it
> which can be useful.
Very nice, Merlin. These aren't really a concern in my case as
I'
On Mon, Apr 4, 2011 at 7:12 PM, C. Bensend wrote:
>
> Hey folks,
>
> So, I'm working on a little application to help me with my
> budget. Yeah, there are apps out there to do it, but I'm having
> a good time learning some more too. :)
>
> I get paid every other Friday. I thought, for schedu
> generate_series(date '2001-01-05', date '2020-12-31', interval '2 weeks')
>
>
> will return every payday from jan 5 2001 to the end of 2020 (assuming
> the 5th was payday, change the start to jan 12 if that was instead).
And THERE is the winner. I feel like an idiot for not even
considering ge
> Not sure if your needs are like mine, but here is the function I use. It
> stores the date in a config table, and rolls it forward when needed. It
> also calculates it from some "know payroll date", which I'm guessing was
> near when I wrote it? (I'm not sure why I choose Nov 16 2008.) for m
> It is a very simplistic approach since you do not take into account
> holidays. But if it meets your needs what you want is the modulo operator
> (
> "%"; "mod(x,y)" is the equivalent function ) which performs division but
> returns only the remainder.
>
> N % 14 = [a number between 0 and (14 -
generate_series(date '2001-01-05', date '2020-12-31', interval '2 weeks')
will return every payday from jan 5 2001 to the end of 2020 (assuming
the 5th was payday, change the start to jan 12 if that was instead).
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make
On 04/04/2011 07:12 PM, C. Bensend wrote:
Hey folks,
So, I'm working on a little application to help me with my
budget. Yeah, there are apps out there to do it, but I'm having
a good time learning some more too. :)
I get paid every other Friday. I thought, for scheduling
purposes in
nd
Sent: Monday, April 04, 2011 8:12 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Plpgsql function to compute "every other Friday"
Hey folks,
So, I'm working on a little application to help me with my budget. Yeah,
there are apps out there to do it, but I
Hey folks,
So, I'm working on a little application to help me with my
budget. Yeah, there are apps out there to do it, but I'm having
a good time learning some more too. :)
I get paid every other Friday. I thought, for scheduling
purposes in this app, that I would take a stab at writing