Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Increase column lengths for CITATION table to fix DataIntegrityViolationException
-- when inserting citations with long keywords or journal names
-- See GitHub issue: value too long for type character varying(255)

INSERT INTO versionhistory(patchnumber, patchlabel, patchdescription)
VALUES (11, 'increase-citation-column-lengths',
'Increase keywords column from 255 to 1000 and journal column from 255 to 500 to prevent data truncation errors');

-- Increase keywords column length from 255 to 1000
ALTER TABLE citation
ALTER COLUMN keywords TYPE character varying(1000);

-- Increase journal column length from 255 to 500
ALTER TABLE citation
ALTER COLUMN journal TYPE character varying(500);
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public interface TBPersistable extends NexmlWritable {
// Needed to make these bigger. MJD 20090420
public static final int CITATION_TITLE_COLUMN_LENGTH = 500;
public static final int CITATION_ABSTRACT_COLUMN_LENGTH = 10000;
public static final int CITATION_KEYWORDS_COLUMN_LENGTH = 1000;
public static final int CITATION_JOURNAL_COLUMN_LENGTH = 500;

public Long getId();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void setVolume(String pNewVolume) {
*
* @return String
*/
@Column(name = "Journal", length = TBPersistable.COLUMN_LENGTH_STRING)
@Column(name = "Journal", length = TBPersistable.CITATION_JOURNAL_COLUMN_LENGTH)
public String getJournal() {
return mJournal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void setPages(String pNewPages) {
*
* @return String
*/
@Column(name = "Keywords", length = TBPersistable.COLUMN_LENGTH_STRING)
@Column(name = "Keywords", length = TBPersistable.CITATION_KEYWORDS_COLUMN_LENGTH)
public String getKeywords() {
return mKeywords;
}
Expand Down
4 changes: 2 additions & 2 deletions treebase-core/src/main/resources/TBASE2_POSTGRES_CREATION.sql
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ CREATE TABLE citation
url character varying(255),
abstract character varying(10000),
doi character varying(255),
keywords character varying(255),
keywords character varying(1000),
pages character varying(255),
publishyear integer,
published boolean,
title character varying(500),
issue character varying(255),
journal character varying(255),
journal character varying(500),
volume character varying(255),
isbn character varying(255),
booktitle character varying(255),
Expand Down