to_char PL/MI fix

Started by Karel Zakover 23 years ago15 messagespatches
Jump to latest
#1Karel Zak
zakkr@zf.jcu.cz

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.

Fixed outputs:

select to_char(x, '9999.999') as x,
to_char(x, 'S9999.999') as s,
to_char(x, 'SG9999.999') as sg,
to_char(x, 'MI9999.999') as mi,
to_char(x, 'PL9999.999') as pl,
to_char(x, 'PLMI9999.999') as plmi,
to_char(x, '9999.999SG') as sg2,
to_char(x, '9999.999PL') as pl2,
to_char(x, '9999.999MI') as mi2 from num;

x | s | sg | mi | pl |
-----------+-----------+-----------+-----------+------------+
123.000 | +123.000 | + 123.000 | 123.000 | + 123.000 |
-123.000 | -123.000 | - 123.000 | - 123.000 | -123.000 |
-1231.000 | -1231.000 | -1231.000 | -1231.000 | -1231.000 |
1231.000 | +1231.000 | +1231.000 | 1231.000 | + 1231.000 |
1.900 | +1.900 | + 1.900 | 1.900 | + 1.900 |
-1.900 | -1.900 | - 1.900 | - 1.900 | -1.900 |
-.900 | -.900 | - .900 | - .900 | -.900 |
.900 | +.900 | + .900 | .900 | + .900 |
.945 | +.945 | + .945 | .945 | + .945 |
-.945 | -.945 | - .945 | - .945 | -.945 |
-150.945 | -150.945 | - 150.945 | - 150.945 | -150.945 |
150.945 | +150.945 | + 150.945 | 150.945 | + 150.945 |

| plmi | sg2 | pl2 | mi2
+------------+-----------+------------+-----------
| + 123.000 | 123.000+ | 123.000+ | 123.000
| - 123.000 | 123.000- | -123.000 | 123.000-
| -1231.000 | 1231.000- | -1231.000 | 1231.000-
| + 1231.000 | 1231.000+ | 1231.000+ | 1231.000
| + 1.900 | 1.900+ | 1.900+ | 1.900
| - 1.900 | 1.900- | -1.900 | 1.900-
| - .900 | .900- | -.900 | .900-
| + .900 | .900+ | .900+ | .900
| + .945 | .945+ | .945+ | .945
| - .945 | .945- | -.945 | .945-
| - 150.945 | 150.945- | -150.945 | 150.945-
| + 150.945 | 150.945+ | 150.945+ | 150.945

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

Attachments:

formatting-02242003.patch.gzapplication/x-gzipDownload
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Karel Zak (#1)
Re: to_char PL/MI fix

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
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.

--
Peter Eisentraut peter_e@gmx.net

#3Karel Zak
zakkr@zf.jcu.cz
In reply to: Peter Eisentraut (#2)
Re: to_char PL/MI fix

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@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

#4Karel Zak
zakkr@zf.jcu.cz
In reply to: Karel Zak (#3)
Re: to_char PL/MI fix

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@zf.jcu.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@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

#5Bruce Momjian
bruce@momjian.us
In reply to: Karel Zak (#4)
Re: to_char PL/MI fix

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@zf.jcu.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@zf.jcu.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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#6Bruce Momjian
bruce@momjian.us
In reply to: Karel Zak (#1)
Re: to_char PL/MI fix

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

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

Karel Zak wrote:

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.

Fixed outputs:

select to_char(x, '9999.999') as x,
to_char(x, 'S9999.999') as s,
to_char(x, 'SG9999.999') as sg,
to_char(x, 'MI9999.999') as mi,
to_char(x, 'PL9999.999') as pl,
to_char(x, 'PLMI9999.999') as plmi,
to_char(x, '9999.999SG') as sg2,
to_char(x, '9999.999PL') as pl2,
to_char(x, '9999.999MI') as mi2 from num;

x | s | sg | mi | pl |
-----------+-----------+-----------+-----------+------------+
123.000 | +123.000 | + 123.000 | 123.000 | + 123.000 |
-123.000 | -123.000 | - 123.000 | - 123.000 | -123.000 |
-1231.000 | -1231.000 | -1231.000 | -1231.000 | -1231.000 |
1231.000 | +1231.000 | +1231.000 | 1231.000 | + 1231.000 |
1.900 | +1.900 | + 1.900 | 1.900 | + 1.900 |
-1.900 | -1.900 | - 1.900 | - 1.900 | -1.900 |
-.900 | -.900 | - .900 | - .900 | -.900 |
.900 | +.900 | + .900 | .900 | + .900 |
.945 | +.945 | + .945 | .945 | + .945 |
-.945 | -.945 | - .945 | - .945 | -.945 |
-150.945 | -150.945 | - 150.945 | - 150.945 | -150.945 |
150.945 | +150.945 | + 150.945 | 150.945 | + 150.945 |

| plmi | sg2 | pl2 | mi2
+------------+-----------+------------+-----------
| + 123.000 | 123.000+ | 123.000+ | 123.000
| - 123.000 | 123.000- | -123.000 | 123.000-
| -1231.000 | 1231.000- | -1231.000 | 1231.000-
| + 1231.000 | 1231.000+ | 1231.000+ | 1231.000
| + 1.900 | 1.900+ | 1.900+ | 1.900
| - 1.900 | 1.900- | -1.900 | 1.900-
| - .900 | .900- | -.900 | .900-
| + .900 | .900+ | .900+ | .900
| + .945 | .945+ | .945+ | .945
| - .945 | .945- | -.945 | .945-
| - 150.945 | 150.945- | -150.945 | 150.945-
| + 150.945 | 150.945+ | 150.945+ | 150.945

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#7Bruce Momjian
bruce@momjian.us
In reply to: Karel Zak (#1)
Re: to_char PL/MI fix

Patch applied. Thanks.

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

Karel Zak wrote:

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.

Fixed outputs:

select to_char(x, '9999.999') as x,
to_char(x, 'S9999.999') as s,
to_char(x, 'SG9999.999') as sg,
to_char(x, 'MI9999.999') as mi,
to_char(x, 'PL9999.999') as pl,
to_char(x, 'PLMI9999.999') as plmi,
to_char(x, '9999.999SG') as sg2,
to_char(x, '9999.999PL') as pl2,
to_char(x, '9999.999MI') as mi2 from num;

x | s | sg | mi | pl |
-----------+-----------+-----------+-----------+------------+
123.000 | +123.000 | + 123.000 | 123.000 | + 123.000 |
-123.000 | -123.000 | - 123.000 | - 123.000 | -123.000 |
-1231.000 | -1231.000 | -1231.000 | -1231.000 | -1231.000 |
1231.000 | +1231.000 | +1231.000 | 1231.000 | + 1231.000 |
1.900 | +1.900 | + 1.900 | 1.900 | + 1.900 |
-1.900 | -1.900 | - 1.900 | - 1.900 | -1.900 |
-.900 | -.900 | - .900 | - .900 | -.900 |
.900 | +.900 | + .900 | .900 | + .900 |
.945 | +.945 | + .945 | .945 | + .945 |
-.945 | -.945 | - .945 | - .945 | -.945 |
-150.945 | -150.945 | - 150.945 | - 150.945 | -150.945 |
150.945 | +150.945 | + 150.945 | 150.945 | + 150.945 |

| plmi | sg2 | pl2 | mi2
+------------+-----------+------------+-----------
| + 123.000 | 123.000+ | 123.000+ | 123.000
| - 123.000 | 123.000- | -123.000 | 123.000-
| -1231.000 | 1231.000- | -1231.000 | 1231.000-
| + 1231.000 | 1231.000+ | 1231.000+ | 1231.000
| + 1.900 | 1.900+ | 1.900+ | 1.900
| - 1.900 | 1.900- | -1.900 | 1.900-
| - .900 | .900- | -.900 | .900-
| + .900 | .900+ | .900+ | .900
| + .945 | .945+ | .945+ | .945
| - .945 | .945- | -.945 | .945-
| - 150.945 | 150.945- | -150.945 | 150.945-
| + 150.945 | 150.945+ | 150.945+ | 150.945

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#8Bruce Momjian
bruce@momjian.us
In reply to: Karel Zak (#1)
Re: to_char PL/MI fix

This patch caused the following regression failures. Is the new output
valid?

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

Karel Zak wrote:

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.

Fixed outputs:

select to_char(x, '9999.999') as x,
to_char(x, 'S9999.999') as s,
to_char(x, 'SG9999.999') as sg,
to_char(x, 'MI9999.999') as mi,
to_char(x, 'PL9999.999') as pl,
to_char(x, 'PLMI9999.999') as plmi,
to_char(x, '9999.999SG') as sg2,
to_char(x, '9999.999PL') as pl2,
to_char(x, '9999.999MI') as mi2 from num;

x | s | sg | mi | pl |
-----------+-----------+-----------+-----------+------------+
123.000 | +123.000 | + 123.000 | 123.000 | + 123.000 |
-123.000 | -123.000 | - 123.000 | - 123.000 | -123.000 |
-1231.000 | -1231.000 | -1231.000 | -1231.000 | -1231.000 |
1231.000 | +1231.000 | +1231.000 | 1231.000 | + 1231.000 |
1.900 | +1.900 | + 1.900 | 1.900 | + 1.900 |
-1.900 | -1.900 | - 1.900 | - 1.900 | -1.900 |
-.900 | -.900 | - .900 | - .900 | -.900 |
.900 | +.900 | + .900 | .900 | + .900 |
.945 | +.945 | + .945 | .945 | + .945 |
-.945 | -.945 | - .945 | - .945 | -.945 |
-150.945 | -150.945 | - 150.945 | - 150.945 | -150.945 |
150.945 | +150.945 | + 150.945 | 150.945 | + 150.945 |

| plmi | sg2 | pl2 | mi2
+------------+-----------+------------+-----------
| + 123.000 | 123.000+ | 123.000+ | 123.000
| - 123.000 | 123.000- | -123.000 | 123.000-
| -1231.000 | 1231.000- | -1231.000 | 1231.000-
| + 1231.000 | 1231.000+ | 1231.000+ | 1231.000
| + 1.900 | 1.900+ | 1.900+ | 1.900
| - 1.900 | 1.900- | -1.900 | 1.900-
| - .900 | .900- | -.900 | .900-
| + .900 | .900+ | .900+ | .900
| + .945 | .945+ | .945+ | .945
| - .945 | .945- | -.945 | .945-
| - 150.945 | 150.945- | -150.945 | 150.945-
| + 150.945 | 150.945+ | 150.945+ | 150.945

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

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

Attachments:

/bjm/difftext/plainDownload+26-26
#9Karel Zak
zakkr@zf.jcu.cz
In reply to: Bruce Momjian (#8)
Re: to_char PL/MI fix

On Thu, Mar 20, 2003 at 01:17:22AM -0500, Bruce Momjian wrote:

This patch caused the following regression failures. Is the new output
valid?

Good point. I will prepare separate patch with tests and docs fix.

Karel

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

Karel Zak wrote:

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.

Fixed outputs:

select to_char(x, '9999.999') as x,
to_char(x, 'S9999.999') as s,
to_char(x, 'SG9999.999') as sg,
to_char(x, 'MI9999.999') as mi,
to_char(x, 'PL9999.999') as pl,
to_char(x, 'PLMI9999.999') as plmi,
to_char(x, '9999.999SG') as sg2,
to_char(x, '9999.999PL') as pl2,
to_char(x, '9999.999MI') as mi2 from num;

x | s | sg | mi | pl |
-----------+-----------+-----------+-----------+------------+
123.000 | +123.000 | + 123.000 | 123.000 | + 123.000 |
-123.000 | -123.000 | - 123.000 | - 123.000 | -123.000 |
-1231.000 | -1231.000 | -1231.000 | -1231.000 | -1231.000 |
1231.000 | +1231.000 | +1231.000 | 1231.000 | + 1231.000 |
1.900 | +1.900 | + 1.900 | 1.900 | + 1.900 |
-1.900 | -1.900 | - 1.900 | - 1.900 | -1.900 |
-.900 | -.900 | - .900 | - .900 | -.900 |
.900 | +.900 | + .900 | .900 | + .900 |
.945 | +.945 | + .945 | .945 | + .945 |
-.945 | -.945 | - .945 | - .945 | -.945 |
-150.945 | -150.945 | - 150.945 | - 150.945 | -150.945 |
150.945 | +150.945 | + 150.945 | 150.945 | + 150.945 |

| plmi | sg2 | pl2 | mi2
+------------+-----------+------------+-----------
| + 123.000 | 123.000+ | 123.000+ | 123.000
| - 123.000 | 123.000- | -123.000 | 123.000-
| -1231.000 | 1231.000- | -1231.000 | 1231.000-
| + 1231.000 | 1231.000+ | 1231.000+ | 1231.000
| + 1.900 | 1.900+ | 1.900+ | 1.900
| - 1.900 | 1.900- | -1.900 | 1.900-
| - .900 | .900- | -.900 | .900-
| + .900 | .900+ | .900+ | .900
| + .945 | .945+ | .945+ | .945
| - .945 | .945- | -.945 | .945-
| - 150.945 | 150.945- | -150.945 | 150.945-
| + 150.945 | 150.945+ | 150.945+ | 150.945

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 359-1001
+  If your life is a hard drive,     |  13 Roberts Road
+  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
*** ./expected/int8.out	Fri Sep 20 12:44:55 2002
--- ./results/int8.out	Thu Mar 20 01:11:21 2003
***************
*** 155,161 ****
SELECT '' AS to_char_5,  to_char(q2, 'MI9999999999999999')     FROM INT8_TBL;	
to_char_5 |      to_char       
! -----------+--------------------
|                456
|   4567890123456789
|                123
--- 155,161 ----

SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL;
to_char_5 | to_char
! -----------+-------------------
| 456
| 4567890123456789
| 123
***************
*** 175,181 ****

SELECT '' AS to_char_7,  to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL;
to_char_7 |      to_char       
! -----------+--------------------
| 456TH
| 4567890123456789TH
| 123RD
--- 175,181 ----

SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL;
to_char_7 | to_char
! -----------+---------------------
| 456TH
| 4567890123456789TH
| 123RD

======================================================================

*** ./expected/numeric.out	Fri Sep 20 12:44:55 2002
--- ./results/numeric.out	Thu Mar 20 01:11:45 2003
***************
*** 762,768 ****
SELECT '' AS to_char_5,  to_char(val, 'MI9999999999999999.999999999999999')     FROM num_data;	
to_char_5 |              to_char               
! -----------+------------------------------------
|                   .000000000000000
|                   .000000000000000
| -        34338492.215397047000000
--- 762,768 ----

SELECT '' AS to_char_5, to_char(val, 'MI9999999999999999.999999999999999') FROM num_data;
to_char_5 | to_char
! -----------+-----------------------------------
| .000000000000000
| .000000000000000
| - 34338492.215397047000000
***************
*** 792,807 ****

SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data;
to_char_7 | to_char
! -----------+----------------------
! | 0.
! | 0.
| <34338492.215397047>
! | 4.31
! | 7799461.4119
! | 16397.038491
! | 93901.57763026
| <83028485.>
! | 74881.
| <24926804.04504742>
(10 rows)

--- 792,807 ----

SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data;
to_char_7 | to_char
! -----------+-------------------------------------
! | .000000000000000TH
! | .000000000000000TH
| <34338492.215397047>
! | 4.310000000000000TH
! | 7799461.411900000000000TH
! | 16397.038491000000000TH
! | 93901.577630260000000TH
| <83028485.>
! | 74881.000000000000000TH
| <24926804.04504742>
(10 rows)

***************
*** 958,965 ****
SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data;
to_char_18 |                                to_char                                
------------+-----------------------------------------------------------------------
!             |                                 . +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
!             |                                 . +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
|                 -3 4 3 3 8 4 9 2 . 2 1 5 3 9 7 0 4 7 0 0 0 0 0 0 0 0 
|                               +4 . 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
|                   +7 7 9 9 4 6 1 . 4 1 1 9 0 0 0 0 0 0 0 0 0 0 0 0 0 
--- 958,965 ----
SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data;
to_char_18 |                                to_char                                
------------+-----------------------------------------------------------------------
!             |                                 +. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
!             |                                 +. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
|                 -3 4 3 3 8 4 9 2 . 2 1 5 3 9 7 0 4 7 0 0 0 0 0 0 0 0 
|                               +4 . 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
|                   +7 7 9 9 4 6 1 . 4 1 1 9 0 0 0 0 0 0 0 0 0 0 0 0 0 

======================================================================

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

#10Bruce Momjian
bruce@momjian.us
In reply to: Karel Zak (#9)
Re: to_char PL/MI fix

Is the new output valid? If so I can easily at least fix those.

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

Karel Zak wrote:

On Thu, Mar 20, 2003 at 01:17:22AM -0500, Bruce Momjian wrote:

This patch caused the following regression failures. Is the new output
valid?

Good point. I will prepare separate patch with tests and docs fix.

Karel

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

Karel Zak wrote:

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.

Fixed outputs:

select to_char(x, '9999.999') as x,
to_char(x, 'S9999.999') as s,
to_char(x, 'SG9999.999') as sg,
to_char(x, 'MI9999.999') as mi,
to_char(x, 'PL9999.999') as pl,
to_char(x, 'PLMI9999.999') as plmi,
to_char(x, '9999.999SG') as sg2,
to_char(x, '9999.999PL') as pl2,
to_char(x, '9999.999MI') as mi2 from num;

x | s | sg | mi | pl |
-----------+-----------+-----------+-----------+------------+
123.000 | +123.000 | + 123.000 | 123.000 | + 123.000 |
-123.000 | -123.000 | - 123.000 | - 123.000 | -123.000 |
-1231.000 | -1231.000 | -1231.000 | -1231.000 | -1231.000 |
1231.000 | +1231.000 | +1231.000 | 1231.000 | + 1231.000 |
1.900 | +1.900 | + 1.900 | 1.900 | + 1.900 |
-1.900 | -1.900 | - 1.900 | - 1.900 | -1.900 |
-.900 | -.900 | - .900 | - .900 | -.900 |
.900 | +.900 | + .900 | .900 | + .900 |
.945 | +.945 | + .945 | .945 | + .945 |
-.945 | -.945 | - .945 | - .945 | -.945 |
-150.945 | -150.945 | - 150.945 | - 150.945 | -150.945 |
150.945 | +150.945 | + 150.945 | 150.945 | + 150.945 |

| plmi | sg2 | pl2 | mi2
+------------+-----------+------------+-----------
| + 123.000 | 123.000+ | 123.000+ | 123.000
| - 123.000 | 123.000- | -123.000 | 123.000-
| -1231.000 | 1231.000- | -1231.000 | 1231.000-
| + 1231.000 | 1231.000+ | 1231.000+ | 1231.000
| + 1.900 | 1.900+ | 1.900+ | 1.900
| - 1.900 | 1.900- | -1.900 | 1.900-
| - .900 | .900- | -.900 | .900-
| + .900 | .900+ | .900+ | .900
| + .945 | .945+ | .945+ | .945
| - .945 | .945- | -.945 | .945-
| - 150.945 | 150.945- | -150.945 | 150.945-
| + 150.945 | 150.945+ | 150.945+ | 150.945

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 359-1001
+  If your life is a hard drive,     |  13 Roberts Road
+  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
*** ./expected/int8.out	Fri Sep 20 12:44:55 2002
--- ./results/int8.out	Thu Mar 20 01:11:21 2003
***************
*** 155,161 ****
SELECT '' AS to_char_5,  to_char(q2, 'MI9999999999999999')     FROM INT8_TBL;	
to_char_5 |      to_char       
! -----------+--------------------
|                456
|   4567890123456789
|                123
--- 155,161 ----

SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL;
to_char_5 | to_char
! -----------+-------------------
| 456
| 4567890123456789
| 123
***************
*** 175,181 ****

SELECT '' AS to_char_7,  to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL;
to_char_7 |      to_char       
! -----------+--------------------
| 456TH
| 4567890123456789TH
| 123RD
--- 175,181 ----

SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL;
to_char_7 | to_char
! -----------+---------------------
| 456TH
| 4567890123456789TH
| 123RD

======================================================================

*** ./expected/numeric.out	Fri Sep 20 12:44:55 2002
--- ./results/numeric.out	Thu Mar 20 01:11:45 2003
***************
*** 762,768 ****
SELECT '' AS to_char_5,  to_char(val, 'MI9999999999999999.999999999999999')     FROM num_data;	
to_char_5 |              to_char               
! -----------+------------------------------------
|                   .000000000000000
|                   .000000000000000
| -        34338492.215397047000000
--- 762,768 ----

SELECT '' AS to_char_5, to_char(val, 'MI9999999999999999.999999999999999') FROM num_data;
to_char_5 | to_char
! -----------+-----------------------------------
| .000000000000000
| .000000000000000
| - 34338492.215397047000000
***************
*** 792,807 ****

SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data;
to_char_7 | to_char
! -----------+----------------------
! | 0.
! | 0.
| <34338492.215397047>
! | 4.31
! | 7799461.4119
! | 16397.038491
! | 93901.57763026
| <83028485.>
! | 74881.
| <24926804.04504742>
(10 rows)

--- 792,807 ----

SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data;
to_char_7 | to_char
! -----------+-------------------------------------
! | .000000000000000TH
! | .000000000000000TH
| <34338492.215397047>
! | 4.310000000000000TH
! | 7799461.411900000000000TH
! | 16397.038491000000000TH
! | 93901.577630260000000TH
| <83028485.>
! | 74881.000000000000000TH
| <24926804.04504742>
(10 rows)

***************
*** 958,965 ****
SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data;
to_char_18 |                                to_char                                
------------+-----------------------------------------------------------------------
!             |                                 . +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
!             |                                 . +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
|                 -3 4 3 3 8 4 9 2 . 2 1 5 3 9 7 0 4 7 0 0 0 0 0 0 0 0 
|                               +4 . 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
|                   +7 7 9 9 4 6 1 . 4 1 1 9 0 0 0 0 0 0 0 0 0 0 0 0 0 
--- 958,965 ----
SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data;
to_char_18 |                                to_char                                
------------+-----------------------------------------------------------------------
!             |                                 +. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
!             |                                 +. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
|                 -3 4 3 3 8 4 9 2 . 2 1 5 3 9 7 0 4 7 0 0 0 0 0 0 0 0 
|                               +4 . 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
|                   +7 7 9 9 4 6 1 . 4 1 1 9 0 0 0 0 0 0 0 0 0 0 0 0 0 

======================================================================

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#11Karel Zak
zakkr@zf.jcu.cz
In reply to: Bruce Momjian (#10)
Re: to_char PL/MI fix

On Thu, Mar 20, 2003 at 10:45:54AM -0500, Bruce Momjian wrote:

Is the new output valid? If so I can easily at least fix those.

Hmm.. it's almost valid :-) I found new minor bug in combination FM and PR.
I will fix it as soon as possible...

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

#12Bruce Momjian
bruce@momjian.us
In reply to: Karel Zak (#11)
Re: to_char PL/MI fix

I have backed out this patch until regression test changes are supplied.

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

Karel Zak wrote:

On Thu, Mar 20, 2003 at 10:45:54AM -0500, Bruce Momjian wrote:

Is the new output valid? If so I can easily at least fix those.

Hmm.. it's almost valid :-) I found new minor bug in combination FM and PR.
I will fix it as soon as possible...

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

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

Attachments:

/pgpatches/to_chartext/plainDownload+86-87
#13Karel Zak
zakkr@zf.jcu.cz
In reply to: Bruce Momjian (#12)
Re: to_char PL/MI fix

On Fri, Mar 21, 2003 at 09:12:40PM -0500, Bruce Momjian wrote:

I have backed out this patch until regression test changes are supplied.

There is new patch with code, regression tests and docs changes.
Please, apply it.

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

Attachments:

formatting-03262003.patch.gzapplication/x-gzipDownload
#14Bruce Momjian
bruce@momjian.us
In reply to: Karel Zak (#13)
Re: to_char PL/MI fix

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

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

Karel Zak wrote:

On Fri, Mar 21, 2003 at 09:12:40PM -0500, Bruce Momjian wrote:

I have backed out this patch until regression test changes are supplied.

There is new patch with code, regression tests and docs changes.
Please, apply it.

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

[ Attachment, skipping... ]

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#15Bruce Momjian
bruce@momjian.us
In reply to: Karel Zak (#13)
Re: to_char PL/MI fix

Patch applied. Thanks.

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

Karel Zak wrote:

On Fri, Mar 21, 2003 at 09:12:40PM -0500, Bruce Momjian wrote:

I have backed out this patch until regression test changes are supplied.

There is new patch with code, regression tests and docs changes.
Please, apply it.

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

[ Attachment, skipping... ]

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