bzdbcopy.pl should remove column quoting

RESOLVED FIXED in Bugzilla 3.0

Status

()

RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: bugzilla-mozilla, Assigned: bugzilla-mozilla)

Tracking

Bugzilla 3.0
Bug Flags:
approval +
approval3.0 +

Details

Attachments

(2 attachments)

(Assignee)

Description

11 years ago
As documented by man DBI (ehr, actually it only says it about the table names), $dbh->column_info columns can be quoted if they cause problems.
This is a problem with bzdbcopy as different databases have different quoting chars. This means the output of bz_table_columns_real (basically $dbh->column_info) in bzdbcopy.pl needs special handling to remove the quoting chars.
Note: It is not possible to avoid this quoting beforehand.

The error message you for instance get:
Writing data to the target 'fielddefs' table on Pg...DBD::Pg::st execute failed: ERROR:  invalid input syntax for integer: "type"
[for Statement "INSERT INTO fielddefs ( id,name,"type",custom,description,mailhead,sortkey,obsolete,enter_bug ) VALUES (?,?,?,?,?,?,?,?,?)" with ParamValues: 6='1', 3='type', 7='1', 9='0', 2='bug_id', 8='0', 1='1', 4='0', 5='Bug #'] at contrib/bzdbcopy.pl line 149

The quote char on the target database was "; while the source database sees that as a string. Meaning, instead of selecting the column called type, it will return the string type each time.

None of the Bugzilla columns should cause any problems if not quoted, so attached patch just removes the quoting chars.
(Assignee)

Comment 1

11 years ago
Created attachment 279303 [details] [diff] [review]
Patch v1
Assignee: database → bugzilla-mozilla
Attachment #279303 - Flags: review?(mkanat)

Comment 2

11 years ago
Comment on attachment 279303 [details] [diff] [review]
Patch v1

Make sure to remove the unrelated code at the top (the SOURCE_DB_TYPE thing) before committing this patch.

The middle bit should probably be .+ instead of .*, but that's fine.
Attachment #279303 - Flags: review?(mkanat) → review+

Updated

11 years ago
Flags: approval3.0+
Flags: approval+
Target Milestone: --- → Bugzilla 3.0
(Assignee)

Comment 3

11 years ago
Created attachment 279307 [details] [diff] [review]
Checked in version
(Assignee)

Comment 4

11 years ago
3.0 branch:
Checking in contrib/bzdbcopy.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/bzdbcopy.pl,v  <--  bzdbcopy.pl
new revision: 1.3.2.1; previous revision: 1.3
done

HEAD:
Checking in contrib/bzdbcopy.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/bzdbcopy.pl,v  <--  bzdbcopy.pl
new revision: 1.4; previous revision: 1.3
done
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.