galaxyproject / gxadmin

Handy command line utility for Galaxy administrators :rocket:
https://galaxyproject.github.io/gxadmin/#/
GNU General Public License v3.0
23 stars 27 forks source link

Replace non-integers before casting to integer in get_user_filter #112

Closed cat-bro closed 1 year ago

cat-bro commented 1 year ago

I think this filter was working before we upgraded to postgresql 12. Since then it has only been working for user IDs and there is an error if we try to user usename or email in queries:

cat@dev:~$ gxadmin query jobs-per-user cat
ERROR:  invalid input syntax for type integer: "cat"
LINE 6: ...xy_user.username = 'cat' or galaxy_user.id = CAST('cat' AS I...

This PR is adding a REGEXP_REPLACE so that anything that cannot be cast to integer will be replaced with '-1' before the cast.

hexylena commented 1 year ago

Thanks @cat-bro!