Skip to content

Commit

Permalink
return value used to end loop was being overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoizueta committed Oct 29, 2020
1 parent eb66942 commit e863ad1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions odbc_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2061,9 +2061,10 @@ odbcImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
if (SQL_SUCCESS == ret)
{
int excluded = false;
SQLRETURN getdata_ret;
TableName = (SQLCHAR *) palloc(sizeof(SQLCHAR) * MAXIMUM_TABLE_NAME_LEN);
ret = SQLGetData(tables_stmt, SQLTABLES_NAME_COLUMN, SQL_C_CHAR, TableName, MAXIMUM_TABLE_NAME_LEN, &indicator);
check_return(ret, "Reading table name", tables_stmt, SQL_HANDLE_STMT);
getdata_ret = SQLGetData(tables_stmt, SQLTABLES_NAME_COLUMN, SQL_C_CHAR, TableName, MAXIMUM_TABLE_NAME_LEN, &indicator);
check_return(getdata_ret, "Reading table name", tables_stmt, SQL_HANDLE_STMT);

/* Since we're not filtering the SQLTables call by schema
we must exclude here tables that belong to other schemas.
Expand All @@ -2072,8 +2073,8 @@ odbcImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
So we only reject tables for which the schema is not
blank and different from the desired schema:
*/
ret = SQLGetData(tables_stmt, SQLTABLES_SCHEMA_COLUMN, SQL_C_CHAR, table_schema, MAXIMUM_SCHEMA_NAME_LEN, &indicator);
if (SQL_SUCCESS == ret)
getdata_ret = SQLGetData(tables_stmt, SQLTABLES_SCHEMA_COLUMN, SQL_C_CHAR, table_schema, MAXIMUM_SCHEMA_NAME_LEN, &indicator);
if (SQL_SUCCESS == getdata_ret)
{
if (!is_blank_string((char*)table_schema) && strcmp((char*)table_schema, schema_name) )
{
Expand Down

0 comments on commit e863ad1

Please sign in to comment.