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

Nullable fields cause pointer addresses to be printed #151

Open
patrickpichler opened this issue Apr 30, 2024 · 0 comments · May be fixed by #152
Open

Nullable fields cause pointer addresses to be printed #151

patrickpichler opened this issue Apr 30, 2024 · 0 comments · May be fixed by #152

Comments

@patrickpichler
Copy link
Contributor

Describe the bug
When querying a table with nullable fields in clickhouse (postgres doesn't have this behavior), the result prints the pointer address instead of the value. After some debugging it looks like clickhouse is using pointer types to represent nullability.

To Reproduce
Steps to reproduce the behavior:

  1. Setup a clickhouse instance
  2. Create a table with a nullable column
  3. Insert data into table
  4. Select table (you will now see pointer addresses instead of the values)

Expected behavior
Pointers should be resolved, if they are not nil

Versions (please complete the following information):

  • OS Version: MacOS
  • sqls Version: master (eb695ac)
patrickpichler added a commit to patrickpichler/sqls that referenced this issue Apr 30, 2024
Some databases (e.g. clickhouse) is using pointer values to represent
nullable values when querying from the database. The current logic to
transform values to strings when querying data, does not handle this
correctly. It will simply transform the pointer to a string, which
results in the pointer address being printed.

To handle this, the value reported from the sql driver will now tried to
be extracted, if it is a pointer. This means the value of the pointer
will then be transformed to a string, instead of the pointer directly.

Additionally, some cases where this was causing issues in the clickhouse
implementation have been fixed.

Fixes sqls-server#151
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 a pull request may close this issue.

1 participant