Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB Error: llave duplicada viola restricción de unicidad "controlled_vocab_entries_pkey" #13

Open
juanCure opened this issue Oct 20, 2022 · 2 comments

Comments

@juanCure
Copy link

Hi Goog afternoon I have installed the plugin in 2 instances OJS 2.4.8.2, I have executed the plugin on the source instance using the command:

/usr/bin/php56 tools/importExport.php FullJournalImportExportPlugin export boletin_instituto.tar.gz boletin

The previous command returned me the boletin_instituto.tar.gz file.

When I executed the command to import the resulting tar.gz file using the command

/usr/bin/php56 tools/importExport.php FullJournalImportExportPlugin import boletin_instituto.tar.gz

I got the following error messages:

<h1>DB Error: ERROR:  llave duplicada viola restricción de unicidad «controlled_vocab_entries_pkey»
DETALLE:  Ya existe la llave (controlled_vocab_entry_id)=(100).</h1>ojs2: DB Error: ERROR:  llave duplicada viola restricción de unicidad «controlled_vocab_entries_pkey»
DETALLE:  Ya existe la llave (controlled_vocab_entry_id)=(100).

Is there a way to resolve that error message?

Environment:
PHP 5.6.40
PostgreSQL 9.2.24
Both source and destination OJS versions: 2.4.8.2

Thanks Best Regards

@diegoabadan
Copy link
Member

Hi @juanCure!

Could you check if there is more than one controlled_vocab_entry_id = 100 in the source OJS?

One hypothesis is that this duplication exists at the origin, in which case it would be necessary to remove it beforehand and export the content again.

@juanCure
Copy link
Author

Hi @diegoabadan thanks for your response, I have 783 rows in the controlled_vocab_entries table of the source instance:

 controlled_vocab_entry_id | controlled_vocab_id | seq 
---------------------------+---------------------+-----
                         1 |                   1 |   0
                         2 |                   1 |   1
                         3 |                   1 |   2
                         4 |                   1 |   3
                         5 |                   2 |   0
                         6 |                   2 |   0
                         7 |                   2 |   0
                         8 |                   2 |   0
                         9 |                   2 |   0
                        10 |                   2 |   0
                        11 |                   2 |   0
                        97 |                   4 |   0
                        98 |                   4 |   0
                        99 |                   4 |   0
                       100 |                   4 |   0
                       101 |                   4 |   0
                       102 |                   4 |   0
                       103 |                   4 |   0
                       104 |                   4 |   0
...
                       777 |                   4 |   0
                       778 |                   4 |   0
                       779 |                   4 |   0
                       780 |                   4 |   0
                       781 |                   4 |   0
                       782 |                   4 |   0
                       783 |                   4 |   0
(783 filas)

while in the controlled_vocab_entries table of the destination instance I have:

controlled_vocab_entry_id | controlled_vocab_id | seq 
---------------------------+---------------------+-----
                       100 |                 100 |   1
                       101 |                 100 |   2
                       102 |                 100 |   3
                       110 |                 101 |   1
                       111 |                 101 |   2
                       112 |                 101 |   3
                       113 |                 101 |   4
                       114 |                 101 |   5
                       115 |                 101 |   6
                       116 |                 101 |   7
                       120 |                 102 |   1
                       121 |                 102 |   2
                       122 |                 102 |   3
                       130 |                 103 |   1
                       131 |                 103 |   2
                       132 |                 103 |   3
                       133 |                 103 |   4
                       134 |                 103 |   5
                       135 |                 103 |   6
                       136 |                 103 |   7
                       137 |                 103 |   8
                       138 |                 103 |   9
                       139 |                 103 |  10
                       140 |                 103 |  11
                       141 |                 103 |  12
                       150 |                 104 |   1
                       151 |                 104 |   2
                       200 |                 200 |   1
                       201 |                 200 |   2
                       202 |                 200 |   3
                       203 |                 200 |   4
                       300 |                 300 |   1
                       301 |                 300 |   2
                       302 |                 300 |   3
                       303 |                 300 |   4
                       304 |                 300 |   5
                       305 |                 300 |   6
                       306 |                 300 |   7
                       310 |                 301 |   1
                       311 |                 301 |   2
                       312 |                 301 |   3
                       313 |                 301 |   4
                       314 |                 301 |   5
                       315 |                 301 |   6
                       316 |                 301 |   7
(45 filas)

I thought to change the definition of the primary key on this table, to consider the other 2 columns in this table; however I wasn't sure about it. By the other hand, if I remove the rows in the source instance, I suppose I have to remove the rows which reference to the rows in the controlled_vocab_entries table?

Using a query to find which tables have the controlled_vocab_entry_id column I have found these tables:

table_name            
---------------------------------
 controlled_vocab_entries
 controlled_vocab_entry_settings
 user_interests

Do you know if I can remove the rows in these 3 tables, without affecting the functionality of the OJS?

@juanCure juanCure reopened this Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants