Closed Bug 848063 Opened 11 years ago Closed 11 years ago

[Oracle] importxml.pl fails with ORA-01830: comment timestamps are not correctly formatted

Categories

(Bugzilla :: Bug Import/Export & Moving, defect)

4.2.2
defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: mateusz.kusmierczyk, Assigned: LpSolit)

References

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0
Build ID: 20130215130331

Steps to reproduce:

Using importxml.pl to marge 2 bugzilla instances.


Actual results:

import script failed with:

DBD::Oracle::st execute failed: ORA-01830: date format picture ends before converting entire input string (DBD ERROR: error possibly near <*> indicator at char 161 in 
'INSERT INTO longdescs (bug_id, who, bug_when, isprivate,thetext, work_time) VALUES (:p1, :p2, :<*>p3, :p4, :p5, :p6)') [for Statement "INSERT INTO longdescs (bug_id, who, bug_when, isprivate,thetext, work_time)
VALUES (?, ?, ?, ?, ?, ?)" with ParamValues: :p1="___", :p2="___", :p3="2013-01-21 11:01:55 +0000", :p4=_, :p5="_______ update text ____", :p6=0] at importxml.pl line 1207.
        main::process_bug('XML::Twig=HASH(0x4279074)', 'XML::Twig::Elt=HASH(0x587f664)') called at E:/Software/Perl/site/lib/XML/T
wig.pm line 2085
        XML::Twig::_twig_end('XML::Parser::Expat=HASH(0x4279874)', 'bug') called at E:/Software/Perl/lib/XML/Parser/Expat.pm line
474
        eval {...} called at E:/Software/Perl/lib/XML/Parser/Expat.pm line 474
        XML::Parser::Expat::parse('XML::Parser::Expat=HASH(0x4279874)', '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\
x{a}<!DO...') called at E:/Software/Perl/lib/XML/Parser.pm line 187
        eval {...} called at E:/Software/Perl/lib/XML/Parser.pm line 186
        XML::Parser::parse('XML::Twig=HASH(0x4279074)', '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\x{a}<!DO...') ca
lled at E:/Software/Perl/site/lib/XML/Twig.pm line 691
        eval {...} called at E:/Software/Perl/site/lib/XML/Twig.pm line 691
        XML::Twig::parse('XML::Twig=HASH(0x4279074)', '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\x{a}<!DO...') call
ed at importxml.pl line 1272
 at importxml.pl line 1272.


Expected results:

The comments from XML file should have been imported without the error.
Found that the root cause was date formatting in the exported XML/Oracle.
Turns out XML import converts the dates for bugs but not for comments.

After modifying  the code in importxml.pl to format_time for comment dates the script started working.

XML date format in my file for both bug & coments was the same (2013-01-21 11:01:55 +0000)
Keywords: qawanted
Summary: importxml.pl fails with ORA-01830: date format picture ends before converting entire input string → [Oracle] importxml.pl fails with ORA-01830: comment timestamps are not correctly formatted
Attached patch following diff worked for me (obsolete) — Splinter Review
I can reproduce the error.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: qawanted
Target Milestone: --- → Bugzilla 4.4
Attached patch patch, v1Splinter Review
Your fix is correct, but let's put it at another place, i.e. when parsing the XML file rather than in the SQL query itself. This is also consistent with how we do it with attachments. r=LpSolit as I simply copied Mateusz.
Assignee: import-export → LpSolit
Attachment #721391 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #798345 - Flags: review+
It's impossible to import data when using Oracle due to this bug and the patch applies cleanly to 4.2 too (but not 4.0), so let's take it for 4.2 as well.
Severity: normal → major
Flags: approval?
Flags: approval4.4?
Flags: approval4.2?
Target Milestone: Bugzilla 4.4 → Bugzilla 4.2
This is actually a regression due to bug 562308 which landed in 4.2.
Depends on: 562308
Keywords: regression
Flags: approval?
Flags: approval4.4?
Flags: approval4.4+
Flags: approval4.2?
Flags: approval4.2+
Flags: approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified importxml.pl
Committed revision 8723.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.4/
modified importxml.pl
Committed revision 8601.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified importxml.pl
Committed revision 8225.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: