Re: WIP: to_char, support for EEEE format

From: Brendan Jurd <direvus(at)gmail(dot)com>
To: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: to_char, support for EEEE format
Date: 2009-07-25 06:08:50
Message-ID: 37ed240d0907242308n65de0d7dxdaa00fa0e098815f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/7/24 Euler Taveira de Oliveira <euler(at)timbira(dot)com>:
> Here is my review. The patch applied without problems. The docs and regression
> tests are included. Both of them worked as expected. Also, you included a fix
> in RN format, do it in another patch.
>

Well, I updated an error message for RN to keep it consistent with the
change I made to the nearby EEEE error message.

Neither RN or EEEE is supported for input, and the error messages were
vague on this point (they just said "not supported").

I understand that separate improvements should be submitted as
separate patches, but this is really part of the one improvement.
Implementing EEEE required improving the error messages, and
consistency required that we improve the RN error message also.

> The behavior is not the same as Oracle. Oracle accepts an invalid scientific
> notation '999.9EEEE'. Will we support it too? I think so.
>
> euler=# SELECT to_char(1234.56789, '999.9EEEE');
> ERRO:  invalid format for scientific notation
> DETALHE:  "EEEE" requires exactly one digit before the decimal point.
> DICA:  For example, "9.999EEEE" is a valid format.
>
> TO_CHAR(1234.56789,'999.9EEEE')
> -------------------------------
>  1.2E+03

*shakes fist at Oracle* yes, I suppose we had better follow suit.

> The '9.999eeee' format error message is misleading.
>
> euler=# select to_char(123, '9.999eeee');
> ERRO:  cannot use "EEEE" twice

Ah, thanks for picking up on this. This was a bug in the original
patch. Looks like we forgot to update the formatting keyword for
lowercase "e".

>
> You could include an example in manual too. You could add the two failing
> cases above in regression tests too.
>

I had already added an example to the manual.

Please find attached version 4 of the patch, and incremental diff from
version 3. It fixes the "eeee" bug ("eeee" is now accepted as a valid
form of "EEEE"), and lifts the restriction on only having one digit
before the decimal point.

Cheers,
BJ

Attachment Content-Type Size
EEEE_4.diff.bz2 application/x-bzip2 3.0 KB
EEEE_3-to-4.diff application/octet-stream 3.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jaime Casanova 2009-07-25 06:41:18 Re: Determining client_encoding from client locale
Previous Message Pavel Stehule 2009-07-25 03:40:13 proposal: support empty string as separator for string_to_array