Skip to content

[FIX] postgres: Fix wrong discrete values#3109

Merged
lanzagar merged 2 commits intobiolab:masterfrom
robertcv:fix_sql_char
Jul 4, 2018
Merged

[FIX] postgres: Fix wrong discrete values#3109
lanzagar merged 2 commits intobiolab:masterfrom
robertcv:fix_sql_char

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

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