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.
Created attachment 279303 [details] [diff] [review] Patch v1
Assignee: database → bugzilla-mozilla
Attachment #279303 - Flags: review?(mkanat)
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+
Target Milestone: --- → Bugzilla 3.0
3.0 branch: Checking in contrib/bzdbcopy.pl; /cvsroot/mozilla/webtools/bugzilla/contrib/bzdbcopy.pl,v <-- bzdbcopy.pl new revision: 22.214.171.124; 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.