Re: Allow to_date() and to_timestamp() to accept localized names
От | Juan José Santamaría Flecha |
---|---|
Тема | Re: Allow to_date() and to_timestamp() to accept localized names |
Дата | |
Msg-id | CAC+AXB2a6ei0mPFG7h-NaiBVO5=tKT67rONZmrDzoOcAE-B2Sg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Allow to_date() and to_timestamp() to accept localized names (Arthur Zakirov <zaartur@gmail.com>) |
Ответы |
Re: Allow to_date() and to_timestamp() to accept localized names
|
Список | pgsql-hackers |
On Wed, Jan 15, 2020 at 11:20 AM Arthur Zakirov <zaartur@gmail.com> wrote:
I have some couple picky notes.
Thanks for the review.
> + if (name_len != norm_len)
> + pfree(norm_name);
I'm not sure here. Is it save to assume that if it was allocated a new
norm_name name_len and norm_len always will differ?
Good call, that check can be more robust.
> static const char *const months_full[] = {
> "January", "February", "March", "April", "May", "June", "July",
> - "August", "September", "October", "November", "December", NULL
> + "August", "September", "October", "November", "December"
> };
Unfortunately I didn't see from the patch why it was necessary to remove
last null element from months_full, days_short, adbc_strings,
adbc_strings_long and other arrays. I think it is not good because
unnecessarily increases the patch and adds code like the following:
> + from_char_seq_search(&value, &s, months, localized_names,
> + ONE_UPPER, MAX_MON_LEN, n, have_error,
> + lengthof(months_full));
Here it passes "months" from datetime.c to from_char_seq_search() and
calculates its length using "months_full" array from formatting.c.
With the introduction of seq_search_localized() that can be avoided, minimizing code churn.
Please, find attached a version addressing the above mentioned.
Regards,
Juan José Santamaría Flecha
Вложения
В списке pgsql-hackers по дате отправления: