Skip to content

Commit

Permalink
Merge pull request #125 from CartoDB/fix-varchar-0
Browse files Browse the repository at this point in the history
Map varchar(0) to text
  • Loading branch information
jgoizueta authored Sep 29, 2020
2 parents 47035ae + 8acdf60 commit cd92b83
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion odbc_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ sql_data_type(
break;
case SQL_VARCHAR :
case SQL_WVARCHAR :
if (column_size <= 255)
if (column_size <= 255 && column_size > 0)
{
appendStringInfo(sql_type, "varchar(%u)", (unsigned)column_size);
}
Expand Down Expand Up @@ -1646,6 +1646,10 @@ odbcIterateForeignScan(ForeignScanState *node)
int mapped_pos = list_nth_int(col_position_mask, mask_index);
ColumnConversion conversion = list_nth_int(col_conversion_array, mask_index);

if (col_size == 0) {
col_size = 1024;
}

/* Ignore this column if position is marked as invalid */
if (mapped_pos == -1)
continue;
Expand Down

0 comments on commit cd92b83

Please sign in to comment.