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

PostgreSQL unique constraint violation when editing an entry #12167

Open
2 tasks done
ytzemih opened this issue Nov 9, 2024 · 2 comments
Open
2 tasks done

PostgreSQL unique constraint violation when editing an entry #12167

ytzemih opened this issue Nov 9, 2024 · 2 comments
Labels
Milestone

Comments

@ytzemih
Copy link

ytzemih commented Nov 9, 2024

JabRef version

Latest development branch build (please note build date below)

Operating system

GNU / Linux

Details on version and operating system

Linux Mint Debian 12

Checked with the latest development build (copy version output from About dialog)

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

  1. Open bib file and the entry editor
  2. Change some field (it happened to me when editing the "Publisher" field, but could be other fields as well)
  3. At some point you should observe an exception (see below) in the command line
  4. Doesn't seem to have relevant effects ...

Appendix

...

Log File
2024-11-09 10:22:37 [pool-2-thread-1] org.jabref.logic.search.indexing.BibFieldsIndexer.insertField()
ERROR: Could not add an entry to the index.: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO bib_fields."yks1w6neg84c" ("entryid", "field_name", "field_value_literal", "field_value_transformed")
VALUES (('00229933'), ('publisher'), ('Springer'), ('Springer'))
 was aborted: ERROR: duplicate key value violates unique constraint "yks1w6neg84c_pkey"
  Detail: Key (entryid, field_name)=(00229933, publisher) already exists.  Call getNextException to see other errors in the batch.
	at [email protected]/org.postgresql.jdbc.BatchResultHandler.handleCompletion(Unknown Source)
	at [email protected]/org.postgresql.core.v3.QueryExecutorImpl.execute(Unknown Source)
	at [email protected]/org.postgresql.jdbc.PgStatement.internalExecuteBatch(Unknown Source)
	at [email protected]/org.postgresql.jdbc.PgStatement.executeBatch(Unknown Source)
	at [email protected]/org.postgresql.jdbc.PgPreparedStatement.executeBatch(Unknown Source)
	at [email protected]/org.jabref.logic.search.indexing.BibFieldsIndexer.insertField(Unknown Source)
	at [email protected]/org.jabref.logic.search.indexing.BibFieldsIndexer.updateEntry(Unknown Source)
	at [email protected]/org.jabref.logic.search.IndexManager$8.call(Unknown Source)
	at [email protected]/org.jabref.gui.util.UiTaskExecutor$1.call(Unknown Source)
	at [email protected]/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "yks1w6neg84c_pkey"
  Detail: Key (entryid, field_name)=(00229933, publisher) already exists.
	at [email protected]/org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(Unknown Source)
	at [email protected]/org.postgresql.core.v3.QueryExecutorImpl.processResults(Unknown Source)
	... 15 more
@ytzemih ytzemih changed the title PostgreSQL unique constraint exception thrown when editing an entry PostgreSQL unique constraint violation when editing an entry Nov 9, 2024
@koppor koppor added the search label Nov 9, 2024
@koppor koppor added this to the 6.0-alpha milestone Nov 9, 2024
@ytzemih
Copy link
Author

ytzemih commented Nov 9, 2024

Btw, the same seems to be true for the "Comments" field.

Also, quite consistently, the postgres server in the background takes 100% CPU for a while, but it stops at some point (... or hmm, perhaps it keeps running).

580847 xxx 25 5 233276 34952 30948 R 99.7 0.2 4:04.63 postgres

@ytzemih
Copy link
Author

ytzemih commented Nov 9, 2024

Closing the corresponding file stops the postgres daemon from hazarding but throws (obviously) an exception

2024-11-09 10:38:14 [pool-2-thread-2] org.jabref.logic.search.indexing.BibFieldsIndexer.removeField()
ERROR: Error deleting field from entry in index: org.postgresql.util.PSQLException: This connection has been closed.
	at [email protected]/org.postgresql.jdbc.PgConnection.checkClosed(Unknown Source)
	at [email protected]/org.postgresql.jdbc.PgConnection.createStatement(Unknown Source)
	at [email protected]/org.postgresql.jdbc.PgConnection.createStatement(Unknown Source)
	at [email protected]/org.jabref.logic.search.indexing.BibFieldsIndexer.removeField(Unknown Source)
	at [email protected]/org.jabref.logic.search.indexing.BibFieldsIndexer.updateEntry(Unknown Source)
	at [email protected]/org.jabref.logic.search.IndexManager$8.call(Unknown Source)
	at [email protected]/org.jabref.gui.util.UiTaskExecutor$1.call(Unknown Source)
	at [email protected]/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants