ERROR: there is no unique constraint matching given keys for referenced table "stash_user"

Received the error message while transferring postgres database from bitbucket version 4.14 to upgraded bitbucket version 5.5.0

Postgres transition version is from 9.4 to 9.6

Any help/guidance is highly appreciated!

Detailed error message from logs below:

Caused by: liquibase.exception.DatabaseException: ERROR: there is no unique constraint matching given keys for referenced table "stash_user" [Failed SQL: CREATE TABLE public.bb_comment (id BIGINT NOT NULL, author_id INT NOT NULL, comment_text TEXT NOT NULL, created_timestamp TIMESTAMP WITHOUT TIME ZONE NOT NULL, entity_version INT NOT NULL, thread_id BIGINT, updated_timestamp TIMESTAMP WITHOUT TIME ZONE NOT NULL, CONSTRAINT pk_bb_comment PRIMARY KEY (id), CONSTRAINT fk_bb_comment_author FOREIGN KEY (author_id) REFERENCES public.stash_user(id), CONSTRAINT fk_bb_comment_thread FOREIGN KEY (thread_id) REFERENCES public.bb_comment_thread(id) ON DELETE CASCADE)]

Thanks!

 

1 answer

1 votes
Steven Behnke Community Champion Nov 13, 2017

Please describe your transition process: You need to explain what you've done and where you're at.

To begin with I took a postgres dump from the old bitbucket server running postgres 9.4 which did give an error message as below:

"pg_dump: error reading large object 17526: ERROR:  permission denied for large object 17526"

However, i restored the db dump to the upgraded bitbucket server with postgres 9.6 which did not throw any error while restoring.

Could this be the leading cause to the unique constraint ERROR message?

Thanks for you quick response!

Steven Behnke Community Champion Nov 13, 2017

I'm trying to establish the events:

  1. Bitbucket 4.14, Postgres 9.4
  2. Postgres dump
  3. Error in dump
  4. Import database dump into Bitbucket 5.5.0, Postgres 9.6

Is this correct?

 

I would say the following:

  • I would assume that if you receive an error during export, that the database dump is bad
  • You cannot just SKIP upgrades like this: You should upgrade the application before any transferring. Further you should only do one thing at a time.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

676 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot