Skip to content

Commit

Permalink
Only set a size_limit for VARCHAR when using PostgreSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
ens-bwalts committed Apr 3, 2019
1 parent d657f9d commit 7bd2fdc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/Bio/EnsEMBL/Hive/DBSQL/BaseAdaptor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,14 @@ sub _table_info_loader {
# warn "ColumnInfo [$table_name/$column_name] = $column_type\n";

$column_set{$column_name} = $column_type;
$size_limit{$column_name} = $size_limit;

# PostgreSQL reports a COLUMN_SIZE of 4 for enums, which is not compatible with
# the way slicer does column size checking. Likewise, PostgreSQL reports
# a user-defined TYPE_NAME for enums, rather than 'enum'. Therefore, if
# the DB is PostgreSQL, only set size_limit for varchars
unless (($driver eq 'pgsql') && !($column_type eq 'character varying')) {
$size_limit{$column_name} = $size_limit;
}

if( ($column_name eq $table_name.'_id')
or ($table_name eq 'analysis_base' and $column_name eq 'analysis_id') ) { # a special case (historical)
Expand Down

0 comments on commit 7bd2fdc

Please sign in to comment.