Re: Multi calendar system for pgsql

Поиск
Список
Период
Сортировка
От Chris Browne
Тема Re: Multi calendar system for pgsql
Дата
Msg-id 87zlgj61bj.fsf@dba2.int.libertyrms.com
обсуждение исходный текст
Ответ на Multi calendar system for pgsql  (Mohsen Alimomeni <m.alimomeni@gmail.com>)
Список pgsql-hackers
m.alimomeni@gmail.com (Mohsen Alimomeni) writes:
> I want to try to add a multi calendar system for pgsql. I want to
> know if it will be accepted as a patch to pgsql?

I would expect there to be nearly zero chance of such, at least in the
form of a change to how dates are stored.

As long as there is commonality in epochs and some continuity of
calculations of dates relative to epochs, there shouldn't be any
fundamental problem in adding on functions to do the following sorts
of things:
- Calculate what the UNIX date is for a given date in a given  calendar
- Output a UNIX date in the form indicated by a given calendar

You should avail yourself of the book, _Calendrical Calculations_, by
Edward M Reingold and Nachum Deerschowitz; it presents details of
calculations and conversions of dates between the following calendars:
- Gregorian- Julian- Coptic- Ethiopic- ISO- Islamic- Hebrew- Ecclesiastical Calendars, for dates of Christian holidays
suchas Easter- Old Hindu- Modern Hindu- Mayan- Balinese Pawukon- Persian- Baha'i- French Revolution- Chinese
 

It would seem a whole lot preferable to create functions like (and
there may be better names!):
create function parse_date (locale, text) returns timestampcreate function output_date (local, timestamp) returns text

Thus, you might expect the following:
 select parse_date('Islamic', 'Miharram 1, AH 1');
parse_date
-------------------------622-07-16 00:00:00

Or
select output_date('Persian', '622-03-19'::timestamp);
output_date
-------------------------1 Farvardin AH 1

(It is entirely likely that I'm fracturing spellings of things!
Apologies if I am!)

http://emr.cs.uiuc.edu/home/reingold/calendar-book/index.shtml
-- 
(reverse (concatenate 'string "moc.enworbbc" "@" "enworbbc"))
http://cbbrowne.com/info/x.html
"Thank you for calling PIXAR! If  you have a touch tone phone, you can
get information or reach anybody here  easily!  If your VCR at home is
still blinking '12:00', press '0'  at any time during this message and
an operator will assist you."
-- PIXAR'S toll-free line (1-800-888-9856)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_restore new option -m
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Remove the special cases to prevent minus-zero results in float4