Re: date formatting and tab-complete patch
От | Karel Zak |
---|---|
Тема | Re: date formatting and tab-complete patch |
Дата | |
Msg-id | 20011205174803.D14012@zf.jcu.cz обсуждение исходный текст |
Ответ на | Re: date formatting and tab-complete patch (Manuel Sugawara <masm@fciencias.unam.mx>) |
Ответы |
Re: date formatting and tab-complete patch
Re: date formatting and tab-complete patch |
Список | pgsql-hackers |
On Wed, Dec 05, 2001 at 10:15:37AM -0600, Manuel Sugawara wrote: > Karel Zak <zakkr@zf.jcu.cz> writes: > > > We don't directly call locale stuff in PostgreSQL code. It's > > encapsulated in PGLC_ (pg_locale.c) API and all is cached, for > > this we use localeconv(3) that returns all in one struct. > > > > (What portability of nl_langinfo()? The localeconv() is ANSI C and > > POSIX functions.) > > localenconv is posix and ANSI C but it doesn't provide such > functionality (localized month and day names). nl_langinfo conforms to > "The Single UNIXŽ Specification, Version 2", according to it's manual > page. The portability isn't an issue as long as you provide means to > test and avoid it's use in systems that doesn't provide it. I know > that, at least, Linux and Solaris does, but FreeBSD does not. But we want FreeBSD and others systems too.... > [...] > > Sorry didn't see your original patch (I overlook and delete it in my > > IMBOX:-(). But I have a question -- do you solve vice versa > > conversion from string to timestamp? The basic feature of to_char() > > is that all outputs must be possible parse by to_timestamp() with > > same format definition: > > No, however the work seems pretty easy. > > > test=# select to_char('2001-12-05 00:00:00+01'::timestamp, > > 'fmday dd/month/yyyy'); > > to_char > > ----------------------------- > > wednesday 05/december /2001 > > (1 row) > > This example shows another issue. With localized month and day names > the hardcoded paddings doesn't make sense any more since you may have > a month name longer than 9 chars -septiembre- as instance. Magic "9 chars" is nice and popular Oracle feature :-) > If people is interested I may spend some time working with this. I already thought about it. You are right it's possible implement,but I mean not is good if some feature anticipate othermatter ofproject ... but current to_char(float, '9G999D99') output string that depend on locale. Why don't allow itfor to_chat(timenstamp, ...) too? But don't forget it must be fast, portable and locale stuff mustcached and encapsulatedin pg_locale.c.The "9 chars" can be used for English locales only. Comments? Karel -- Karel Zak <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
В списке pgsql-hackers по дате отправления: