activerecord_views icon indicating copy to clipboard operation
activerecord_views copied to clipboard

.view_populated? throws an error in test environment

Open pineapplethief opened this issue 9 years ago • 1 comments

I have materialized_view (postgres) working perfectly in development environment, but loading test envrionment fails in initializer I defined:

  LeaseRequestsSearch.refresh_view!(concurrent: :auto) if LeaseRequestsSearch.view_populated?

The error is:

SELECT class_name, checksum, options FROM active_record_views WHERE name = 'lease_requests_searches'
ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR:  invalid input syntax for integer: "lease_requests_searches"
LINE 1: ...um, options FROM active_record_views WHERE name = 'lease_req...

I'm not sure how that is possible: table name is clearly not an integer. And it works perfectly well in development environment!

pineapplethief avatar Feb 08 '16 05:02 pineapplethief

That’s a real strange one.

Does the active_record_views table exist in your test database? If so, what does \d active_record_views (in psql) look like?

Are you using config.active_record.schema_format = :sql?

jasoncodes avatar Feb 08 '16 05:02 jasoncodes

I cannot reproduce this. I assume there must have been something else modifying the production schema.

jasoncodes avatar Nov 06 '23 06:11 jasoncodes