I am maintaining a rails 4.2.11 project and using postgres_ext as a dependency. Now as we are planning to update to rails 5 and higher. I noticed that postgres_ext is not maintained anymore and will not work with rails 5 and above. so I am getting this error in the following SQL query. It seems to be in the array IN query. How to fix it? What are more probable changes I have to do in my project?
[2023-01-25T09:10:33.409Z] 1) ChangeRequestActions::DestructionService#destroy_without_transaction when change request have more than one change request action delete action from change request
[2023-01-25T09:10:33.409Z] Failure/Error: company.sections.find_or_create_by(section)
[2023-01-25T09:10:33.409Z]
[2023-01-25T09:10:33.409Z] ActiveRecord::StatementInvalid:
[2023-01-25T09:10:33.409Z] PG::InvalidTextRepresentation: ERROR: malformed array literal: “”
[2023-01-25T09:10:33.409Z] LINE 1: …”position” = $4 AND “sections”.”block_titles” IN (”, ‘Perso…
[2023-01-25T09:10:33.409Z] ^
[2023-01-25T09:10:33.409Z] DETAIL: Array value must start with “{” or dimension information.
[2023-01-25T09:10:33.409Z] : SELECT “sections”.* FROM “sections” WHERE “sections”.”company_id” = $1 AND “sections”.”name” = $2 AND “sections”.”title” = $3 AND “sections”.”position” = $4 AND “sections”.”block_titles” IN (”, ‘Personal Employee Information’, ‘Employee W4 Form Request’, ‘VETS/EEO-1 Reporting’, ‘Asset & Equipment Management’) ORDER BY sections.id LIMIT 1
It seems like you’re encountering a problem with your SQL query. The error is indicating that the
block_titles
column in yoursections
table is being queried with an invalid array literal, which is the empty string (''
).You’ll need to modify your code to avoid using the invalid array literal and ensure that the
block_titles
column is always queried with a valid array.As for the larger problem of transitioning from Rails 4.2.11 to a newer version without
postgres_ext
, you may need to do some additional research and testing to see how your project will be affected by this change, as well as make any necessary modifications to ensure compatibility with the new version of Rails and withoutpostgres_ext
. Keep in mind that this may require updating the code and dependencies in your project, as well as potentially updating the database schema and data.