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] postgres: Fix wrong discrete values #3109

Merged
merged 2 commits into from
Jul 4, 2018

Conversation

robertcv
Copy link
Collaborator

@robertcv robertcv commented Jul 2, 2018

Issue

Fixes #3108

Description of changes

Remove traling spaces.

Includes
  • Code changes
  • Tests
  • Documentation

@@ -165,6 +165,8 @@ def _guess_variable(self, field_name, field_metadata, inspect_table):
if type_code in CHAR_TYPES:
if inspect_table:
values = self.get_distinct_values(field_name, inspect_table)
# remove trailing spaces
values = [v.rstrip() for v in values]
Copy link
Member

@astaric astaric Jul 3, 2018

Choose a reason for hiding this comment

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

Why not modify the query to cast to ::text like it will be done in further selects?

Copy link
Collaborator Author

@robertcv robertcv Jul 3, 2018

Choose a reason for hiding this comment

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

get_distinct_values encapsulates filed_name into quotes and the query becomes invalid. On request, I can move the encapsulation from get_distinct_values and add it outside function calls.

Copy link
Member

Choose a reason for hiding this comment

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

no, it is ok the way it is.

@lanzagar lanzagar changed the title postgres: fix wrong discrete values [FIX] postgres: Fix wrong discrete values Jul 4, 2018
@lanzagar lanzagar merged commit 7c7bcbc into biolab:master Jul 4, 2018
@robertcv robertcv deleted the fix_sql_char branch August 2, 2018 07:22
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.

3 participants