From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Allow to_date() and to_timestamp() to accept localized names |
Date: | 2019-09-22 12:33:22 |
Message-ID: | CAC+AXB2JOe4Dw1teZP-N-isNyDdY3F96oGFVYFxhmWtsbgi=ig@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Sep 18, 2019 at 11:09 AM Juan José Santamaría Flecha
<juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
> On Fri, Sep 13, 2019 at 10:31 PM Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
> >
> Thanks for taking a look at this.
>
> > I'm confused why we acquire the MONTH_DIM / etc definitions. Can't we
> > just use lengthof() of the corresponding array? AFAICS it should work
> > just as well.
> >
>
> It was because of the length difference between ascii-name arrays,
> which were all null-ended, and localized-name arrays. The attached
> version uses lengthof().
>
> > I wonder if the "compare first char" thing (seq_search_localized) really
> > works when there are multibyte chars in the day/month names. I think
> > the code compares just the first char ... but what if the original
> > string uses those funny Unicode non-normalized letters and the locale
> > translation uses normalized letters? My guess is that the first-char
> > comparison will fail, but surely you'll want the name to match.
> > (There's no month/day name in Spanish that doesn't start with an ASCII
> > letter, but I bet there are some in other languages.) I think the
> > localized comparison should avoid the first-char optimization, just
> > compare the whole string all the time, and avoid possible weird issues.
>
> The localized search is reformulated in this version to deal with
> multibyte normalization. A regression test for this issue is included.
This version is updated to optimize the need for dynamic allocation.
> Regards,
>
> Juan José Santamaría Flecha
Attachment | Content-Type | Size |
---|---|---|
0001-Allow-localized-month-names-to_date-v3.patch | application/x-patch | 17.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Dolgov | 2019-09-22 13:45:01 | Re: Index Skip Scan |
Previous Message | Darafei Komяpa Praliaskouski | 2019-09-22 11:47:17 | Re: Unwanted expression simplification in PG12b2 |