From: Arthur Zakirov <zaartur@gmail.com>
To: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Allow to_date() and to_timestamp() to accept localized names
Date: Wed, 15 Jan 2020 19:20:25 +0900
Message-ID: <ba6fa1fd-ad60-d1ea-7226-676790c108ca@gmail.com> (raw)
In-Reply-To: <CAC+AXB1rLC7Gu7-fTQPNwSY9sFC9hkpn8_J3WyGwaKXvNZnoVQ@mail.gmail.com>
References: <CAC+AXB2JOe4Dw1teZP-N-isNyDdY3F96oGFVYFxhmWtsbgi=ig@mail.gmail.com>
<20190925195745.GA21894@alvherre.pgsql>
<CAC+AXB12A7Fr9djoq7f1-WYesnZTRKpGpHM12MRG+M00mewN9g@mail.gmail.com>
<20200111160602.4wwvyl7lo3oxoewf@development>
<CAC+AXB1rLC7Gu7-fTQPNwSY9sFC9hkpn8_J3WyGwaKXvNZnoVQ@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: zaartur@gmail.com, juanjo.santamaria@gmail.com, tomas.vondra@2ndquadrant.com, alvherre@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Allow to_date() and to_timestamp() to accept localized names
In-Reply-To: <ba6fa1fd-ad60-d1ea-7226-676790c108ca@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox