Skip to content

Commit

Permalink
Fix comma-separation of column in generated CREATE FOREIGN TABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoizueta committed Oct 21, 2020
1 parent 91af33a commit a8e9119
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion odbc_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,7 @@ odbcImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
SQLLEN indicator;
const char* schema_name;
bool missing_foreign_schema = false;
bool first_column = true;

elog_debug("%s", __func__);

Expand Down Expand Up @@ -2008,10 +2009,15 @@ odbcImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
elog(NOTICE, "Data type not supported (%d) for column %s", DataType, ColumnName);
continue;
}
if (i > 1)
if (!first_column)
{
appendStringInfo(&col_str, ", ");
}
else
{
first_column = false;
}

appendStringInfo(&col_str, "\"%s\" %s", ColumnName, (char *) sql_type.data);
}
SQLCloseCursor(query_stmt);
Expand Down

0 comments on commit a8e9119

Please sign in to comment.