Re: Allow to_date() and to_timestamp() to accept localized names

From: Arthur Zakirov <zaartur(at)gmail(dot)com>
To: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Allow to_date() and to_timestamp() to accept localized names
Date: 2020-01-15 10:20:25
Message-ID: ba6fa1fd-ad60-d1ea-7226-676790c108ca@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

On 2020/01/13 21:04, Juan José Santamaría Flecha wrote:
> Please, find attached a version addressing the above mentioned.

I have some couple picky notes.

> + 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?

> 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.

--
Arthur

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2020-01-15 10:21:36 Re: [PATCH v1] pg_ls_tmpdir to show directories
Previous Message Paul Guo 2020-01-15 10:18:15 Re: standby recovery fails (tablespace related) (tentative patch and discussion)