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

RESOLVED FIXED in Bugzilla 4.2

Status

()

Bugzilla
Bug Import/Export & Moving
--
major
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Mateusz Kuśmierczyk, Assigned: Frédéric Buclin)

Tracking

({regression})

4.2.2
Bugzilla 4.2
regression
Bug Flags:
approval +
approval4.4 +
approval4.2 +

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

4 years ago
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.
(Reporter)

Comment 1

4 years ago
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)
(Assignee)

Updated

4 years ago
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
(Reporter)

Comment 2

4 years ago
Created attachment 721391 [details] [diff] [review]
following diff worked for me
(Assignee)

Comment 3

4 years ago
I can reproduce the error.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: qawanted
Target Milestone: --- → Bugzilla 4.4
(Assignee)

Comment 4

4 years ago
Created attachment 798345 [details] [diff] [review]
patch, v1

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+
(Assignee)

Comment 5

4 years ago
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
(Assignee)

Comment 6

4 years ago
This is actually a regression due to bug 562308 which landed in 4.2.
Depends on: 562308
Keywords: regression

Updated

4 years ago
Flags: approval?
Flags: approval4.4?
Flags: approval4.4+
Flags: approval4.2?
Flags: approval4.2+
Flags: approval+
(Assignee)

Comment 7

4 years ago
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
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.