-- Give run_isok_queries() an IQName that's not on ISOK_QUERIES -- and see we get a good error message. SELECT * FROM run_isok_queries($$VALUES ('non_existant_iqname')$$); ERROR: run_isok_queries: Error executing the supplied argument, which should be an SQL query that returns isok_queries.iqname values DETAIL: The error is: Error in run_isok_queries(TEXT) The detail is: Supplied query returned a value (non_existant_iqname) that is not an existing ISOK_QUERIES.IQName value The query is: VALUES ('non_existant_iqname') Additional diagnostic information: PL/pgSQL function run_isok_queries(text) line 69 at RAISE HINT: Try executing the SQL query (VALUES ('non_existant_iqname')) and check that it returns the public.isok_queries.iqname values of the queries you wish to run. Then, call run_isok_queries() with your corrected argument. (You will probably need to dollar-quote your argument.) CONTEXT: PL/pgSQL function run_isok_queries(text) line 442 at RAISE