Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix columns iteration #123

Merged
merged 2 commits into from
Sep 29, 2020
Merged

Fix columns iteration #123

merged 2 commits into from
Sep 29, 2020

Conversation

jgoizueta
Copy link

We've had cases of empty column lists in some cases with the ODBC drivers for BigQuery and Snowflake.

After some debugging with the latter, it seems that column iteration may be interrupted by SQLFetch erros responses like these:

DEBUG:   HY000:0:6:[Snowflake][Snowflake] (6)
      Assertion failure: GEOGRAPHY_type_unsupported
DEBUG:  FETCHING HY000:2:6:[Snowflake][Snowflake] (6)
      Assertion failure: USER_DEFINED_TYPE_type_unsupported

With this patch those errors are ignored (skipping columns of unsupported types) and the iteration is resumed.

Copy link

@rafatower rafatower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if (SQL_SUCCEEDED(diag_ret))
elog(DEBUG1, "FETCHING %s:%ld:%ld:%s\n", state, (long int) j, (long int) native, text);
}
while( diag_ret == SQL_SUCCESS );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from my ignorance: don't you want to log anything when ret == SQL_ERROR ? or is that covered by the diag_ret ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that diag_ret is the result of calling GetDescRec to get diagnostic messages iteratively (there may be multiple messages). According to documentation SQL_NO_DATA should signal the end of the iteration, but I'm stopping at anything other than SQL_SUCCESS to avoid handling errors here 🙈 (hopefully unlikely)

@jgoizueta jgoizueta merged commit c041628 into master Sep 29, 2020
@jgoizueta jgoizueta deleted the fix-empty-columns branch September 29, 2020 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants