KNOWLEDGE BASE

Site Import Failing With Error "ERROR: insert or update on table "tasks" violates foreign key constraint "tasks_schedule_id_fkey"..."


Published: 08 Jun 2021
Last Modified Date: 08 Jun 2021

Issue

When running a Tableau Server Site Import the following error will appear in the job output through the CLI:

Site Import CLI Error

The siteimportexport log will show the following as the cause of the import error.  The ID value here will vary.

Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "tasks" violates foreign key constraint "tasks_schedule_id_fkey"

  Detail: Key (schedule_id)=(-86) is not present in table "schedules".


Environment

  • Tableau Server 2020.1+
  • Windows
  • Linux

Resolution

1. Verify the mappingsScheduleMapper.csv for case sensitivity

There can be multiple schedules of the same name with different casing.  Make sure the schedule names in the target_name column match exactly with the schedules listed in the target site.

2. Create placeholder schedules in the target site for any system schedules that appear in the mapping file.  The following may appear in the mappingsScheduleMapper.csv mapping file:

Database Service Canonicalization RemoveTablePoundSignChange Schedule
Database Service Canonicalization SlashDirectionChange Schedule
Database Service Canonicalization BigQueryIgnoreHostChange Schedule
Database Service Canonicalization GoogleSheetsNameChange Schedule

The following KB article has details on these system schedules that may appear when performing an import in an older version of Tableau Server to a more current version 2020.1+

https://kb.tableau.com/articles/issue/Unable-to-Migrate-sites-due-to-unknown-Database-Service-Canonicalization-schedules-from-source-site

 

Cause

Due to case sensitivity and system schedules that may appear, the target site may not have the appropriate schedules in place for the entries within the schedules mapping file during the verification process.  If the import cannot find the exact target schedules to map the source schedules to, then the import will fail.
Did this article resolve the issue?