Re: to_char PL/MI fix

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: to_char PL/MI fix
Date: 2003-03-17 17:12:45
Message-ID: 200303171712.h2HHCjY16492@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Yes, I am getting to it. Thanks.

---------------------------------------------------------------------------

Karel Zak wrote:
>
>
> What do with this patch? I think commit to CVS :-)
>
> Karel
>
>
> On Tue, Feb 25, 2003 at 09:38:54AM +0100, Karel Zak wrote:
> > On Mon, Feb 24, 2003 at 08:16:07PM +0100, Peter Eisentraut wrote:
> > > Karel Zak writes:
> > >
> > > > Peter found bug in the to_char() routine for PL/MI options. This
> > > > patch fix it -- but this patch doesn't contains tests or docs fixes. I
> > > > will send it later.
> > >
> > > I think there is still a problem with PL. It puts the '+' in aligned
> > > position and '-' anchored to the number. Is that correct? If PL were to
> >
> > Yes, it's correct. The MI/PL/SG is PostgreSQL extension, the Oracle
> > knows very limited version of MI only -- it means we can implement it
> > by our idea.
> >
> > > behave like the converse of MI and like it is documented, it would put a
> > > '+' in aligned position and never put a '-' anywhere. Also, due to this
> > > apparent problem, PL creates extra whitespace in front of the number.
> >
> > PL shows '+' or ' ' on wanted position and not disable '-' beacuse
> > the negative number without '-' is other number. I think disable '-'
> > for PL will produce mazy outputs (there is not problem implement it,
> > but I don't think it's good idea, if you need something like this you
> > can use abs() or define format that handle '-').
> >
> > The anchored '-' is disabled only if output format contains other option which
> > handle '-' (like S/SG/MI).
> >
> > The extra space for PL is for anchored '-', if format option contains MI or SG
> > this space is not used.
> >
> > select to_char(x, 'PL9999.999') as pl, to_char(x, 'PLMI9999.999') as plmi from num;
> > pl | plmi
> > ------------+------------
> > + 123.000 | + 123.000
> > -123.000 | - 123.000
> > -1231.000 | -1231.000
> > + 1231.000 | + 1231.000
> > + 1.900 | + 1.900
> > -1.900 | - 1.900
> > -.900 | - .900
> > + .900 | + .900
> > + .945 | + .945
> > -.945 | - .945
> > -150.945 | - 150.945
> > + 150.945 | + 150.945
> >
> > in the 'pl' column is '-' angored to number because is there no other way
> > how show it.
> >
> >
> > test=# select to_char(x, '"Number:"PL9999.999MI') as pl from num;
> > pl
> > -------------------
> > Number:+ 123.000
> > Number: 123.000-
> > Number: 1231.000-
> > Number:+1231.000
> > Number:+ 1.900
> > Number: 1.900-
> > Number: .900-
> > Number:+ .900
> > Number:+ .945
> > Number: .945-
> > Number: 150.945-
> > Number:+ 150.945
> >
> > there is not extra space beacuse MI is used.
> >
> > Karel
> >
> > --
> > Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
> > http://home.zf.jcu.cz/~zakkr/
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
>
> --
> Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
> http://home.zf.jcu.cz/~zakkr/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-03-17 17:21:15 Re: fixups for 7.3 to contrib directories
Previous Message Karel Zak 2003-03-17 08:56:22 Re: to_char PL/MI fix