Re: FM format modifier does not remove leading zero from year

From: Guy Rouillier <guyr-ml1(at)burntmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: FM format modifier does not remove leading zero from year
Date: 2010-01-06 20:08:49
Message-ID: 4B44EDD1.3080906@burntmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 1/5/2010 10:54 AM, Tom Lane wrote:
> Adrian Klaver<aklaver(at)comcast(dot)net> writes:
>> From what I could see in the source code
>> (src/backend/utils/adt/formatting.c) the year portion of the string is
>> not run through the FM modifier. A fix would mean a patch to the above
>> AFAIK.
>
> Should it be? Can anyone check how this works on Oracle?
>

Oracle states clearly in the SQL Reference manual:

"A modifier can appear in a format model more than once. In such a case,
each subsequent occurrence toggles the effects of the modifier."

I get the following results:

select to_char(DATE'2009-1-1','FMDD.FMMM.FMYY') from dual;

1.01.9

select to_char(DATE'2009-1-1','FM DD.MM.YY') from dual

1.1.9

--
Guy Rouillier

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2010-01-06 20:11:12 Re: How psql source code can be protected?
Previous Message Steve Wampler 2010-01-06 19:33:15 timestamp fields and order by?

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-01-06 20:14:47 unresolved bugs
Previous Message David E. Wheeler 2010-01-06 19:53:45 Re: Status of plperl inter-sp calling