Re: Days in month query

Поиск
Список
Период
Сортировка
От Mike Nolan
Тема Re: Days in month query
Дата
Msg-id 200503310026.j2V0QXej002448@gw.tssi.com
обсуждение исходный текст
Ответ на Days in month query  (Mark Fox <mark.fox@gmail.com>)
Список pgsql-general
> > What I want is SELECT statement that references no tables but returns
> > the days in a given month.   I'm now thinking that I might be able to
> > come up with something using an IN clause and using EXTRACT, but
> > haven't figured it out yet.

I have a 'last_day' function (duplicating what the equivalent Oracle
function does), from that you can extract the number of days in the month.

Here's my 'last_day' function:

create or replace function public.last_day(date)
returns date as
'
DECLARE
  this_day alias for $1;
  declare wk_day date;
BEGIN

  wk_day := date_trunc(''month'', this_day) + interval ''1 month''
      - interval ''1 day'';
  return wk_day;
END
' language 'plpgsql';
--
Mike Nolan

В списке pgsql-general по дате отправления:

Предыдущее
От: Arthur Hoogervorst
Дата:
Сообщение: Re: Days in month query
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Ayuda con procesamiento en Postgres !!!!