dbTalk Databases Forums  

[Info-Ingres] The good the bad and the ugly. corrupt decimals.

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] The good the bad and the ugly. corrupt decimals. in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Paul White
 
Posts: n/a

Default [Info-Ingres] The good the bad and the ugly. corrupt decimals. - 08-25-2011 , 01:30 PM






Hi all,



Here's one to distract you on a Friday. I discovered corrupt data in
decimal fields when I used to unloaddb to copy production to test. New
records inserted are corrupt. Old data appears intact. I suspect the
problem is due to incorrectly compiled OpenROAD code but haven't been able
to prove this. It may well be that the bug is already fixed and I need to
go back to an older image to reproduce the problem. The users have not been
reporting errors in the application and copying data is error free.
OpenROAD displays the corrupt data but reports no error - see the attached
pic. There is an inconsistency somewhere and Ingres is not picking up.



Before I embark on the data fix, I'm interested in suggestions for further
debug.



Here, asset 13 is the new data.

* select * from ar_tax_depr_schedule

Executing . . .

Quote:
asset_code|cost_year|cost_period|opening_value
tax_depreciation|closing_value |rolled|

13 | 2011| 9| 88;.34| :?1=24=625<6.14|
36891>=1<?=;.24| |

Quote:
13 | 2011| 12| 36891>=1<?=;.24| :999999990:7.:4|
9<>?753735<;.14| |

Quote:
13 | 2012| 3| 9<>?753735<;.14| :999999990:7.:4|
?6:;<749377:.?4| |

....

Quote:
H00001 | 2007| 10| 7811.00| 72.34|
7738.66|R |

Quote:
H00001 | 2007| 11| 7738.66| 433.97|
7304.69|R |

Quote:
H00001 | 2007| 12| 7304.69| 433.96|
6870.73|R |

Quote:
H00001 | 2008| 1| 6870.73| 381.73|
6489.00|R |



unload from prod

* copy ar_tax_depr_schedule () into './ar_tax_depr_schedule.ingres'

Executing . . .

(104166 rows)



load to test

* copy ar_tax_depr_schedule () from './ar_tax_depr_schedule.ingres'

with allocation = 4, row_estimate = 104153

E_CO0032 COPY: Bad data value for column 'opening_value' encountered while
processing row 1.

E_CO002B COPY: 1 rows could not be processed.

E_CO002A COPY: Copy has been aborted.

- Terminated by Errors





Similar problem when doing a character unload/reload

* * copy ar_tax_depr_schedule(

asset_code= varchar(0)tab,

cost_year= c0tab,

cost_period= c0tab,

opening_value= varchar(0)tab,

tax_depreciation= varchar(0)tab,

closing_value= varchar(0)tab,

rolled= varchar(0)nl,

nl= d0nl)

into './ar_tax_depr_schedule.ingres'

Executing . . .

(104166 rows)



* * copy ar_tax_depr_schedule(

asset_code= varchar(0)tab,

cost_year= c0tab,

cost_period= c0tab,

opening_value= varchar(0)tab,

tax_depreciation= varchar(0)tab,

closing_value= varchar(0)tab,

rolled= varchar(0)nl,

nl= d0nl)

from './ar_tax_depr_schedule.ingres'

with allocation = 4,

row_estimate = 104166

Executing . . .



E_CO0039 COPY: Error processing row 1. Cannot convert column

'opening_value' to tuple format.



E_US100F String cannot be converted to numeric due to incorrect syntax.

E_CO002B COPY: 1 rows could not be processed.

E_CO002A COPY: Copy has been aborted.





auditdb shows mostly corrupt data going in, but there is an occasional good
one.

45824-Begin : Transaction Id 00004ced4ea132c2 19-Jul-2011 12:15:39.70
Username ingres

45825: Insert/Append : Transaction Id 00004ced4ea132c2 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

45826- Record: <15|2011|9|=<<.>4|:643;=?4?756.04|?1283<02:9:<.>4| >

45827: Insert/Append : Transaction Id 00004ced4ea132c2 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

45828- Record: <15|2011|12|?1283<02:9:<.>4|;07.84|?1283<0::=4<.=4 |>

45829: Insert/Append : Transaction Id 00004ced4ea132c2 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

45830- Record: <15|2012|3|?1283<0::=4<.=4|;07.84|?1283<02:0?<.=4| >

...

47290-Begin : Transaction Id 00004ced4ea14e51 19-Jul-2011 13:39:00.09
Username ingres

47291: Insert/Append : Transaction Id 00004ced4ea14e51 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

47292- Record: <27|2011|12|>89.<4|245;6?3?==42.>4|593180456::9.<4 |>

47293: Insert/Append : Transaction Id 00004ced4ea14e51 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

47294- Record: <27|2012|3|593180456::9.<4|204.74|593180456?19.;4| >

47295: Insert/Append : Transaction Id 00004ced4ea14e51 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

47296- Record: <27|2012|6|593180456?19.;4|204.74|593180456389.;4| >

...

47896-Begin : Transaction Id 00004ced4ea160c1 19-Jul-2011 14:08:09.80
Username ingres

47897: Insert/Append : Transaction Id 00004ced4ea160c1 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

47898- Record: <34|2011|12|809.64|2.84|509.64|>

47899: Insert/Append : Transaction Id 00004ced4ea160c1 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

47900- Record: <34|2012|3|509.64|4.24|<09.54|>

47901: Insert/Append : Transaction Id 00004ced4ea160c1 Id (3157,0)
Table [ar_tax_depr_schedule,ingres]

47902- Record: <34|2012|6|<09.54|4.24|309.54|>

...





There was a schema change prior to 19 July, unfortunately journals for the
event are gone. Float fields were changed to decimal(14,2). A similar
depreciation table was changed in the same way but does not have these
problems. OpenROAD user class and procedures were changed also, but there is
currently an inconsistency in the code. In one area the variables are
decimal(14,3) but another has decimal(14,2). There is a code fix pending.



I can't reproduce the problem on an identically defined table in the test
database on the same machine, but I'm not yet sure what sequence of steps in
the application is generating the corrupt data or if I am testing with the
right version of the application image.



I can't see anything unusual in iicolumns. Help table and copydb generate
normal looking schema.



OpenROAD 5.0

Ingres 9.2.1 P13824



Inserting using interactive SQL works ok.

insert into ar_tax_depr_schedule values (' 001', 2011,1,123,456,789,'')

...

insert into ar_tax_depr_schedule values (' 001',
2011,6,12345678,45678901,78901234,'')

select * from ar_tax_depr_schedule

Executing . . .

+------------------+-------------+-------------+----------------+-----------
-----+----------------+------+

Quote:
asset_code |cost_year |cost_period |opening_value
tax_depreciation|closing_value |rolled|
+------------------+-------------+-------------+----------------+-----------
-----+----------------+------+

Quote:
001 | 2011| 1| 123.00|
456.00| 789.00| |

Quote:
001 | 2011| 2| 1234.00|
4567.00| 7890.00| |

Quote:
001 | 2011| 3| 12345.00|
45678.00| 78901.00| |

Quote:
001 | 2011| 4| 123456.00|
456789.00| 789012.00| |

Quote:
001 | 2011| 5| 1234567.00|
4567890.00| 7890123.00| |

Quote:
001 | 2011| 6| 12345678.00|
45678901.00| 78901234.00| |

Quote:
15 | 2011| 9| =<<.>4|
:643;=?4?756.04| ?1283<02:9:<.>4| |

Quote:
15 | 2011| 12| ?1283<02:9:<.>4|
;07.84| ?1283<0::=4<.=4| |

Quote:
15 | 2012| 3| ?1283<0::=4<.=4|
;07.84| ?1283<02:0?<.=4| |





Copying to another identical table copies the corrupt data without errors.

* insert into pw_decimals select * from ar_tax_depr_schedule

Executing . . .

(104589 rows)

continue

* select * from pw_decimals

Executing . . .

+------------------+-------------+-------------+----------------+-----------
-----+----------------+------+

Quote:
asset_code |cost_year |cost_period |opening_value
tax_depreciation|closing_value |rolled|
+------------------+-------------+-------------+----------------+-----------
-----+----------------+------+

Quote:
001 | 2011| 1| 123.00|
456.00| 789.00| |

Quote:
001 | 2011| 2| 1234.00|
4567.00| 7890.00| |

Quote:
001 | 2011| 3| 12345.00|
45678.00| 78901.00| |

Quote:
001 | 2011| 4| 123456.00|
456789.00| 789012.00| |

Quote:
001 | 2011| 5| 1234567.00|
4567890.00| 7890123.00| |

Quote:
001 | 2011| 6| 12345678.00|
45678901.00| 78901234.00| |

Quote:
15 | 2011| 9| =<<.>4|
:643;=?4?756.04| ?1283<02:9:<.>4| |

Quote:
15 | 2011| 12| ?1283<02:9:<.>4|
;07.84| ?1283<0::=4<.=4| |

Quote:
15 | 2012| 3| ?1283<0::=4<.=4|
;07.84| ?1283<02:0?<.=4| |

Quote:
15 | 2012| 6| ?1283<02:0?<.=4|
;07.84| ?1283<0::49<.<4| |

Quote:
15 | 2012| 9| ?1283<0::49<.<4|
;07.84| ?1283<02:84<.;4| |

...

Quote:
34 | 2021| 3| 806.04|
4.24| 5.84| |

Quote:
34 | 2021| 6| 5.84|
4.24| 4.>4| |

Quote:
34 | 2021| 9| 4.>4|
4.24| 3.84| |

Quote:
34 | 2021| 11| 3.84|
3.84| 0.00| |

Quote:
H00001 | 2007| 10| 7811.00|
72.34| 7738.66|R |

Quote:
H00001 | 2007| 11| 7738.66|
433.97| 7304.69|R |

Quote:
H00001 | 2007| 12| 7304.69|
433.96| 6870.73|R |

Quote:
H00001 | 2008| 1| 6870.73|
381.73| 6489.00|R |

Quote:
H00001 | 2008| 2| 6489.00|
381.72| 6107.28|R |





Copying to a table defined with floats looks like it worked but those
numbers are wrong

* insert into pw_floats select * from ar_tax_depr_schedule

Executing . . .

(104589 rows)

continue

* select * from pw_floats

Executing . . .

+------------------+-------------+-------------+-----------+-----------+----
-------+------+

Quote:
asset_code |cost_year |cost_period
opening_val|tax_depreci|closing_val|rolled|
+------------------+-------------+-------------+-----------+-----------+----
-------+------+

Quote:
001 | 2011| 1| 123.000| 456.000|
789.000| |

Quote:
001 | 2011| 2| 1234.000| 4567.000|
7890.000| |

Quote:
001 | 2011| 3| 12345.000| 45678.000|
78901.000| |

Quote:
001 | 2011| 4| 123456.000| 456789.000|
789012.000| |

Quote:
001 | 2011|
5|1234567.000|4567890.000|7890123.000| |

Quote:
001 | 2011| 6| 1.235e+007| 4.568e+007|
7.890e+007| |

Quote:
15 | 2011| 9| 1433.440| 1.064e+012|
1.513e+012| |

Quote:
15 | 2011| 12| 1.513e+012| 1107.840|
1.513e+012| |

Quote:
15 | 2012| 3| 1.513e+012| 1107.840|
1.513e+012| |

Quote:
15 | 2012| 6| 1.513e+012| 1107.840|
1.513e+012| |

Quote:
15 | 2012| 9| 1.513e+012| 1107.840|
1.513e+012| |

...

Quote:
34 | 2021| 9| 5.440| 4.240|
3.840| |

Quote:
34 | 2021| 11| 3.840| 3.840|
0.000| |

Quote:
H00001 | 2007| 10| 7811.000| 72.340|
7738.660|R |

Quote:
H00001 | 2007| 11| 7738.660| 433.970|
7304.690|R |

Quote:
H00001 | 2007| 12| 7304.690| 433.960|
6870.730|R |

Quote:
H00001 | 2008| 1| 6870.730| 381.730|
6489.000|R |

Quote:
H00001 | 2008| 2| 6489.000| 381.720|
6107.280|R |

Quote:
H00001 | 2008| 3| 6107.280| 381.730|
5725.550|R |

...





I think can restore the corrupt records by reloading into a table defined
with float fields. Then I plan to extract the good data from the bad,
hopefully leaving out the ugly.



* copy pw_float() from 'ar_tax_depr_schedule.ingres'

Executing . . .

(104583 rows)

continue

* select * from pw_float

Executing . . .

+------------------+-------------+-------------+-----------+-----------+----
-------+------+

Quote:
asset_code |cost_year |cost_period
opening_val|tax_depreci|closing_val|rolled|
+------------------+-------------+-------------+-----------+-----------+----
-------+------+

Quote:
15 | 2011| 9| 15800.000| 131.666|
15668.334| |

Quote:
15 | 2011| 12| 15668.334| 395.000|
15273.334| |

Quote:
15 | 2012| 3| 15273.334| 395.000|
14878.334| |

Quote:
15 | 2012| 6| 14878.334| 395.000|
14483.334| |

Quote:
15 | 2012| 9| 14483.334| 395.000|
14088.334| |

Quote:
15 | 2012| 12| 14088.334| 395.000|
13693.334| |

Quote:
15 | 2013| 3| 13693.334| 395.000|
13298.334| |

Quote:
15 | 2013| 6| 13298.334| 395.000|
12903.334| |

...

Quote:
34 | 2020| 12| 168.000| 36.000|
132.000| |

Quote:
34 | 2021| 3| 132.000| 36.000|
96.000| |

Quote:
34 | 2021| 6| 96.000| 36.000|
60.000| |

Quote:
34 | 2021| 9| 60.000| 36.000|
24.000| |

Quote:
34 | 2021| 11| 24.000| 24.000|
0.000| |

Quote:
H00001 | 2007| 10| 0.000| 5.972e+058|
6.046e+214|R |

Quote:
H00001 | 2007| 11| 6.046e+214| 2.462e+290|
-0.000|R |

Quote:
H00001 | 2007| 12| -0.000| 2.126e+213|
0.000|R |

Quote:
H00001 | 2008| 1| 0.000| 0.000|
0.000|R |





With depreciation like that, no wonder the accountant is cranky. J



Before I rebuild the table, I thought I should collect some more evidence
for Ingres Support and try out suggestions from the experts. I plan to play
this weekend.





Paul White

&

Shift Seven Solutions

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.