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

Sagun Shrestha November 13, 2017

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 F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2017

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

Sagun Shrestha November 13, 2017

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 F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 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.
devittward June 22, 2018

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
TAGS
AUG Leaders

Atlassian Community Events