samvera-deprecated / curation_concerns

A Hydra-based Rails Engine that extends an application, adding the ability to Create, Read, Update and Destroy (CRUD) objects (based on Hydra::Works) and providing a generator for defining object types with custom workflows, views, access controls, etc.
Other
15 stars 27 forks source link

Type mismatch in PermissionQuery #1152

Closed escowles closed 7 years ago

escowles commented 7 years ago

When I try to transition an object in a Sipity workflow, I get an error in PermissionQuery.scope_users_for_entity_and_roles: "ActiveRecord::StatementInvalid (PG::UndefinedFunction: ERROR: operator does not exist: integer = character varying", because there is a mismatch between the user.id column (integer) and the subquery (which produces varchars). Note: this error doesn't happen with SQLite, but does happen with PostgreSQL.

The query is being executed here: https://github.com/projecthydra/curation_concerns/blob/master/app/services/curation_concerns/workflow/permission_query.rb#L267

We should be able to explicitly cast the user.id value to a varchar.

jcoyne commented 7 years ago

See https://github.com/projecthydra-labs/hyrax/commit/094c540124cb501f35a71e312954acbbdb13179c