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 vote
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.

I have this exact same error on my postgres side. Was this ever resolved? 

On the bb side I have no errors, only warnings regarding spring.

My ticket is:SSP-30116.

I am upgrading from 4.13 bb to 5.10.1 and postgres 9.2.23 to 10.4.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

174 views 20 8
Join discussion

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