Page MenuHomeDevCentral

fantoir-datasource promote fails if Wikidata table contains entry missing from fantoir table to promote
Open, LowPublic

Description

Trying to promote a table still importing, and so with missing records:

WindRiver
$ fantoir-datasource promote fantoir_202304;
thread 'tokio-runtime-worker' panicked at fantoir-datasource/src/db.rs:117:14:
Can't run SQL query.: Database(PgDatabaseError { severity: Error, code: "23503", message: "insert or update on table \"fantoir_wikidata\" violates foreign key constraint \"fantoir_wikidata_code_fantoir_fk\"", detail: Some("Key (code_fantoir)=(9300277130E) is not present in table \"fantoir_202304\"."), hint: None, position: None, where: None, schema: Some("public"), table: Some("fantoir_wikidata"), column: None, data_type: None, constraint: Some("fantoir_wikidata_code_fantoir_fk"), file: Some("ri_triggers.c"), line: Some(2619), routine: Some("ri_ReportViolation") })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I guess promotion should handle this better:

  • Offer an error message basd on PgDatabaseError detail
  • Suggest the user to truncate fantoir_wikidata table as fix

Event Timeline

dereckson created this task.

The field detail is nice as it shows a user-friendly message explaining what's happening: "Key (code_fantoir)=(9300277130E) is not present in table \"fantoir_202304\"."