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

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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Guy Rouillier <guyr-ml1(at)burntmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FM format modifier does not remove leading zero from year
Date: 2010-01-06 20:29:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-hackers
Guy Rouillier <guyr-ml1(at)burntmail(dot)com> writes:
> 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."

*Toggles* the effect of the modifier?  Egad, what drunken idiot chose
that specification?

That's certainly not how PG is interpreting the FM modifier --- we
suppose it applies to just the specifier it's attached to.  Still,
we generally assume that Oracle is the authoritative reference for
how to_char() ought to behave, so maybe we should hold our noses
and change it.  Problem is that this would inevitably break
practically every existing use of to_date with FM :-( (not to mention
the other modifiers, which I suppose behave that way too?)

Anyway, your example clearly shows that FM ought to strip leading
zeroes in YY, so that change ought to get made.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2010-01-06 20:36:39
Subject: Re: unresolved bugs
Previous:From: Stefan KaltenbrunnerDate: 2010-01-06 20:21:34
Subject: Re: snapshot generation broken again...

pgsql-general by date

Next:From: Tom LaneDate: 2010-01-06 20:46:39
Subject: Re: timestamp fields and order by?
Previous:From: Greg SmithDate: 2010-01-06 20:17:28
Subject: Re: Minimizing disk space

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