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

A record with a bigint id can't be queried for when using PostgreSQL #36

Closed
gyfis opened this issue Dec 22, 2022 · 5 comments · Fixed by #39
Closed

A record with a bigint id can't be queried for when using PostgreSQL #36

gyfis opened this issue Dec 22, 2022 · 5 comments · Fixed by #39

Comments

@gyfis
Copy link

gyfis commented Dec 22, 2022

We're using our bigint record IDs in the self.scim_attributes_map, e.g.

def self.scim_attributes_map
  {
    id: :id,

...

  }
end

however, when querying for the id, since by default all attributes are queried as case insensitive, we're getting a query like

WHERE users.id ILIKE 12345

which fails on PostgreSQL, since you can't use LIKE/ILIKE on bigint columns, and id is bigint for us.

I've read the source code and see the comments about case sensitivity being tricky to use, however I can't see a way of configuring this, and the only way I see is to subclass & override either apply_scim_filter or to_activerecord_query_backend methods fully. Is that the expected way forward?

I can see Scimitar exposing a self.case_sensitive_attributes map, empty by default, which would then be used to change the queries. Should I fire a PR with that?

@nhumble-sa
Copy link

This also fails for uuid type columns.

@pond
Copy link
Member

pond commented Jan 9, 2023

Just got back to work after holidays - I'm considering options for it.

(Issue arises since I never really considered an indexed filter on ID rather than just using 'show singular resource').

@pond
Copy link
Member

pond commented Jan 9, 2023

I think this should be sorted in V2 by #39. Once reviewed & merged, the fix should get back-ported to V1. We have some people off sick right now so it might take a day or three - please bear with us!

@bagp1 bagp1 closed this as completed in #39 Jan 10, 2023
@pond
Copy link
Member

pond commented Jan 10, 2023

2.1.3 is now pushed - https://rubygems.org/gems/scimitar/versions/2.1.3

@pond
Copy link
Member

pond commented Jan 10, 2023

1.3.3 back-port done - https://rubygems.org/gems/scimitar/versions/1.3.3

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.

3 participants