Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-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

pgsql-hackers by date

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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group