Thread: to_char PL/MI fix
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
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
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/
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/
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
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
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
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 *** ./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 ======================================================================
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/
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') FROMnum_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') FROMnum_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
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/
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 ? config.log ? GNUmakefile ? config.status ? autom4te.cache ? src/Makefile.global ? src/Makefile.custom ? src/log ? src/backend/postgres ? src/backend/catalog/postgres.description ? src/backend/catalog/postgres.bki ? src/backend/utils/mb/conversion_procs/conversion_create.sql ? src/backend/utils/mb/conversion_procs/ascii_and_mic/libascii_and_mic.so.0.0 ? src/backend/utils/mb/conversion_procs/cyrillic_and_mic/libcyrillic_and_mic.so.0.0 ? src/backend/utils/mb/conversion_procs/euc_cn_and_mic/libeuc_cn_and_mic.so.0.0 ? src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/libeuc_jp_and_sjis.so.0.0 ? src/backend/utils/mb/conversion_procs/euc_kr_and_mic/libeuc_kr_and_mic.so.0.0 ? src/backend/utils/mb/conversion_procs/euc_tw_and_big5/libeuc_tw_and_big5.so.0.0 ? src/backend/utils/mb/conversion_procs/latin2_and_win1250/liblatin2_and_win1250.so.0.0 ? src/backend/utils/mb/conversion_procs/latin_and_mic/liblatin_and_mic.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_ascii/libutf8_and_ascii.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_big5/libutf8_and_big5.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/libutf8_and_cyrillic.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/libutf8_and_euc_cn.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/libutf8_and_euc_jp.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/libutf8_and_euc_kr.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/libutf8_and_euc_tw.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_gb18030/libutf8_and_gb18030.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_gbk/libutf8_and_gbk.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_iso8859/libutf8_and_iso8859.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/libutf8_and_iso8859_1.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_johab/libutf8_and_johab.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_sjis/libutf8_and_sjis.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_tcvn/libutf8_and_tcvn.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_uhc/libutf8_and_uhc.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_win1250/libutf8_and_win1250.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_win1256/libutf8_and_win1256.so.0.0 ? src/backend/utils/mb/conversion_procs/utf8_and_win874/libutf8_and_win874.so.0.0 ? src/bin/initdb/initdb ? src/bin/initlocation/initlocation ? src/bin/ipcclean/ipcclean ? src/bin/pg_config/pg_config ? src/bin/pg_controldata/pg_controldata ? src/bin/pg_ctl/pg_ctl ? src/bin/pg_dump/pg_dump ? src/bin/pg_dump/pg_restore ? src/bin/pg_dump/pg_dumpall ? src/bin/pg_encoding/pg_encoding ? src/bin/pg_id/pg_id ? src/bin/pg_resetxlog/pg_resetxlog ? src/bin/pgtclsh/pgtclsh ? src/bin/pgtclsh/pgtksh ? src/bin/psql/psql ? src/bin/scripts/createdb ? src/bin/scripts/createlang ? src/bin/scripts/createuser ? src/bin/scripts/dropdb ? src/bin/scripts/droplang ? src/bin/scripts/dropuser ? src/include/pg_config.h ? src/include/stamp-h ? src/interfaces/ecpg/ecpglib/libecpg.so.3.4.2 ? src/interfaces/ecpg/pgtypeslib/libpgtypes.so.1.0.0 ? src/interfaces/ecpg/preproc/ecpg ? src/interfaces/jdbc/build.properties ? src/interfaces/jdbc/build ? src/interfaces/jdbc/jars ? src/interfaces/jdbc/org/postgresql/Driver.java ? src/interfaces/libpgtcl/libpgtcl.so.2.4 ? src/interfaces/libpq/libpq.so.3.1 ? src/interfaces/python/lib_pgmodule.so.2.4 ? src/pl/plperl/SPI.c ? src/pl/plperl/libplperl.so.0.0 ? src/pl/plpgsql/src/libplpgsql.so.1.0 ? src/pl/tcl/libpltcl.so.2.0 ? src/pl/tcl/modules/pltcl_loadmod ? src/pl/tcl/modules/pltcl_delmod ? src/pl/tcl/modules/pltcl_listmod ? src/test/regress/pg_regress ? src/test/regress/results ? src/test/regress/regression.out ? src/test/regress/regression.diffs ? src/test/regress/expected/copy.out ? src/test/regress/expected/create_function_1.out ? src/test/regress/expected/create_function_2.out ? src/test/regress/expected/misc.out ? src/test/regress/expected/constraints.out ? src/test/regress/sql/copy.sql ? src/test/regress/sql/create_function_1.sql ? src/test/regress/sql/create_function_2.sql ? src/test/regress/sql/misc.sql ? src/test/regress/sql/constraints.sql Index: src/backend/utils/adt/formatting.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/utils/adt/formatting.c,v retrieving revision 1.58 retrieving revision 1.59 diff -c -r1.58 -r1.59 *** src/backend/utils/adt/formatting.c 10 Mar 2003 22:28:18 -0000 1.58 --- src/backend/utils/adt/formatting.c 20 Mar 2003 05:19:26 -0000 1.59 *************** *** 1,7 **** /* ----------------------------------------------------------------------- * formatting.c * ! * $Header: /cvsroot/pgsql-server/src/backend/utils/adt/formatting.c,v 1.58 2003/03/10 22:28:18 tgl Exp $ * * * Portions Copyright (c) 1999-2002, PostgreSQL Global Development Group --- 1,7 ---- /* ----------------------------------------------------------------------- * formatting.c * ! * $Header: /cvsroot/pgsql-server/src/backend/utils/adt/formatting.c,v 1.59 2003/03/20 05:19:26 momjian Exp $ * * * Portions Copyright (c) 1999-2002, PostgreSQL Global Development Group *************** *** 276,292 **** * Flags for NUMBER version * ---------- */ ! #define NUM_F_DECIMAL 0x01 ! #define NUM_F_LDECIMAL 0x02 ! #define NUM_F_ZERO 0x04 ! #define NUM_F_BLANK 0x08 ! #define NUM_F_FILLMODE 0x10 ! #define NUM_F_LSIGN 0x20 ! #define NUM_F_BRACKET 0x40 ! #define NUM_F_MINUS 0x80 ! #define NUM_F_PLUS 0x100 ! #define NUM_F_ROMAN 0x200 ! #define NUM_F_MULTI 0x400 #define NUM_LSIGN_PRE -1 #define NUM_LSIGN_POST 1 --- 276,294 ---- * Flags for NUMBER version * ---------- */ ! #define NUM_F_DECIMAL 1 << 1 ! #define NUM_F_LDECIMAL 1 << 2 ! #define NUM_F_ZERO 1 << 3 ! #define NUM_F_BLANK 1 << 4 ! #define NUM_F_FILLMODE 1 << 5 ! #define NUM_F_LSIGN 1 << 6 ! #define NUM_F_BRACKET 1 << 7 ! #define NUM_F_MINUS 1 << 8 ! #define NUM_F_PLUS 1 << 9 ! #define NUM_F_ROMAN 1 << 10 ! #define NUM_F_MULTI 1 << 11 ! #define NUM_F_PLUS_POST 1 << 12 ! #define NUM_F_MINUS_POST 1 << 13 #define NUM_LSIGN_PRE -1 #define NUM_LSIGN_POST 1 *************** *** 1052,1057 **** --- 1054,1061 ---- elog(ERROR, "to_char/to_number(): can't use 'S' and 'MI' together."); } num->flag |= NUM_F_MINUS; + if (IS_DECIMAL(num)) + num->flag |= NUM_F_MINUS_POST; break; case NUM_PL: *************** *** 1061,1066 **** --- 1065,1072 ---- elog(ERROR, "to_char/to_number(): can't use 'S' and 'PL' together."); } num->flag |= NUM_F_PLUS; + if (IS_DECIMAL(num)) + num->flag |= NUM_F_PLUS_POST; break; case NUM_SG: *************** *** 3880,3907 **** else { Np->sign = sign; ! ! if (Np->sign != '-') { ! Np->Num->flag &= ~NUM_F_BRACKET; ! Np->Num->flag &= ~NUM_F_MINUS; } - else if (Np->sign != '+') - Np->Num->flag &= ~NUM_F_PLUS; - - if (Np->sign == '+' && IS_FILLMODE(Np->Num) && !IS_LSIGN(Np->Num)) - Np->sign_wrote = TRUE; /* needn't sign */ else ! Np->sign_wrote = FALSE; /* need sign */ ! Np->sign_pos = -1; ! if (Np->Num->lsign == NUM_LSIGN_PRE && Np->Num->pre == Np->Num->pre_lsign_num) ! Np->Num->lsign = NUM_LSIGN_POST; ! /* MI/PL/SG - write sign itself and not in number */ ! if (IS_PLUS(Np->Num) || IS_MINUS(Np->Num)) ! Np->sign_wrote = TRUE; /* needn't sign */ } /* --- 3886,3921 ---- else { Np->sign = sign; ! ! /* MI/PL/SG - write sign itself and not in number */ ! if (IS_PLUS(Np->Num) || IS_MINUS(Np->Num)) { ! if (IS_PLUS(Np->Num) && IS_MINUS(Np->Num)==FALSE) ! Np->sign_wrote = FALSE; ! Np->sign_pos = -1; } else ! { ! if (Np->sign != '-') ! { ! if (IS_BRACKET(Np->Num)) ! Np->Num->flag &= ~NUM_F_BRACKET; ! if (IS_MINUS(Np->Num)) ! Np->Num->flag &= ~NUM_F_MINUS; ! } ! else if (Np->sign != '+' && IS_PLUS(Np->Num)) ! Np->Num->flag &= ~NUM_F_PLUS; ! if (Np->sign == '+' && IS_FILLMODE(Np->Num) && !IS_LSIGN(Np->Num)) ! Np->sign_wrote = TRUE; /* needn't sign */ ! else ! Np->sign_wrote = FALSE; /* need sign */ ! Np->sign_pos = -1; ! if (Np->Num->lsign == NUM_LSIGN_PRE && Np->Num->pre == Np->Num->pre_lsign_num) ! Np->Num->lsign = NUM_LSIGN_POST; ! } } /* *************** *** 3917,3923 **** { if (IS_DECIMAL(Np->Num)) Np->last_relevant = get_last_relevant_decnum( ! Np->number + ((Np->Num->zero_end - Np->num_pre > 0) ? Np->Num->zero_end - Np->num_pre : 0)); } --- 3931,3937 ---- { if (IS_DECIMAL(Np->Num)) Np->last_relevant = get_last_relevant_decnum( ! Np->number + ((Np->Num->zero_end - Np->num_pre > 0) ? Np->Num->zero_end - Np->num_pre : 0)); } *************** *** 3946,3962 **** /* * terrible Ora format */ ! if (!IS_ZERO(Np->Num) && *Np->number == '0' && ! !IS_FILLMODE(Np->Num) && Np->Num->post != 0) { ++Np->sign_pos; if (IS_LSIGN(Np->Num)) { ! if (Np->Num->lsign == NUM_LSIGN_PRE) ! ++Np->sign_pos; ! else --Np->sign_pos; } } --- 3960,3974 ---- /* * terrible Ora format */ ! if (IS_ZERO(Np->Num)==FALSE && *Np->number == '0' && ! IS_FILLMODE(Np->Num)==FALSE && Np->Num->post) { ++Np->sign_pos; if (IS_LSIGN(Np->Num)) { ! if (Np->Num->lsign != NUM_LSIGN_PRE) --Np->sign_pos; } } *************** *** 3975,3982 **** #ifdef DEBUG_TO_FROM_CHAR elog(DEBUG_elog_output, ! ! "\n\tNUM: '%s'\n\tPRE: %d\n\tPOST: %d\n\tNUM_COUNT: %d\n\tNUM_PRE: %d\n\tSIGN_POS: %d\n\tSIGN_WROTE: %s\n\tZERO:%s\n\tZERO_START: %d\n\tZERO_END: %d\n\tLAST_RELEVANT: %s", Np->number, Np->Num->pre, Np->Num->post, --- 3987,3994 ---- #ifdef DEBUG_TO_FROM_CHAR elog(DEBUG_elog_output, ! "\n\tSIGN: '%c'\n\tNUM: '%s'\n\tPRE: %d\n\tPOST: %d\n\tNUM_COUNT: %d\n\tNUM_PRE: %d\n\tSIGN_POS: %d\n\tSIGN_WROTE:%s\n\tZERO: %s\n\tZERO_START: %d\n\tZERO_END: %d\n\tLAST_RELEVANT: %s\n\tBRACKET: %s\n\tPLUS: %s\n\tMINUS:%s", ! Np->sign, Np->number, Np->Num->pre, Np->Num->post, *************** *** 3987,3994 **** IS_ZERO(Np->Num) ? "Yes" : "No", Np->Num->zero_start, Np->Num->zero_end, ! Np->last_relevant ? Np->last_relevant : "<not set>" ! ); #endif /* --- 3999,4009 ---- IS_ZERO(Np->Num) ? "Yes" : "No", Np->Num->zero_start, Np->Num->zero_end, ! Np->last_relevant ? Np->last_relevant : "<not set>", ! IS_BRACKET(Np->Num) ? "Yes" : "No", ! IS_PLUS(Np->Num) ? "Yes" : "No", ! IS_MINUS(Np->Num) ? "Yes" : "No" ! ); #endif /*
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
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
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