-- Fix project_summary view. -- -- New schema version: 0.3.2 -- -- ATTENTION: -- -- ENSURE YOU HAVE BACKED UP THE DATABASE BEFORE RUNNING THIS SCRIPT. -- -- -- NOTE: This upgrade affects all schemas in the database. -- NOTE: Each application starts a transaction, which must be committed -- or rolled back. -- -- This fixes a problem with the project_summary view. In its common table -- expression, the view definition tried to search public.projects based on -- the search path value with the following expression: -- -- (current_setting('search_path'::text) ~~ (p.schema || '%'::text)) -- -- That is of course bound to fail as soon as the schema goes above `survey_9` -- because `survey_10 LIKE ('survey_1' || '%')` is TRUE. -- -- The new mechanism relies on splitting the search_path. -- -- NOTE: The survey schema needs to be the leftmost element in search_path. -- -- To apply, run as the dougal user: -- -- psql <