-
Notifications
You must be signed in to change notification settings - Fork 1
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 Internal Server Error When Filtering by String Column but the value can be interpreted as another type #36
base: main
Are you sure you want to change the base?
Conversation
… column whose data type is not a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests
@@ -532,6 +532,106 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils { | |||
.futureValue | |||
response.headOption.isEmpty must be(true) | |||
} | |||
|
|||
"don't fail when the column is citext or similar, but the value can be interpreted as Int." in withApiClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the value is CITEXT we should interpret it as string, any reason to interpret it as int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before, if the value was "123", it was assumed that the value was an Int, and the same for the column type. This caused an internal server error because it compared a citext with an Int.
Same for the others comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my point of view, the input argument must be handled like the type derived from the database instead of guessing its format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the changes in this pull request consider both the column type and the value to avoid this.
email must be(emailValue) | ||
} | ||
|
||
"don't fail when the column is citext or similar, but the value can be interpreted as Decimal." in withApiClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
email must be(emailValue) | ||
} | ||
|
||
"don't fail when the column is citext or similar, but the value can be interpreted as Date." in withApiClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
email must be(emailValue) | ||
} | ||
|
||
"don't fail when the column is citext or similar, but the value can be interpreted as UUID." in withApiClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
Fixed an Internal Server Error, Caused when attempting to filter by a column is citext or similar, but the value can be interpreted as another type.