On Tue, 21 Jun 2005, Bruce Momjian wrote:
> Pavel Stehule wrote:
> > Hello,
> >
> > I sended version with only LEAST and GREATEST
> > http://archives.postgresql.org/pgsql-patches/2005-06/msg00185.php
>
> OK, did you remove DECODE for a reason?
>
o simplify patch
o decode can be added in future if will be requirement
> > this patch contains diff files for NEXT_DAY and LAST_DAY function too,
> > which I think are generally usefull.
> >
> > There is duplicity with CASE.
>
> I didn't think we needed NEXT_DAY and LAST_DAY because we have +
> interval like + '1 day'. We decided that, right?
>
next_day not equal date + 1day, but like next monday, ... look to doc.
next_day (date, varchar) -- varchar = sunday|monday|...
last_day is very often used function. Really. I can substitute
create or replace function last_day(date) returns date $$
select date_trunc('month', $1 + interval '1month') - 1;
$$ language sql;
but I think can be usefull (for first day we have date_drunc, for
last_date nothing)
regards
Pavel