I have a function in Supabase named search_place_destination and I select Execute Query in Postgres node. but it did not call that function and throw this error for me:
column “history” does not exist
Failed query: SELECT * FROM search_place_destination(“history”, 2);
Here is my function in Supabase
CREATE OR REPLACE FUNCTION search_place_destination(search_string text, result_limit integer)
RETURNS TABLE(place_name text, address text, ticket text, open_close_hour text, description text) AS $$
DECLARE
search_terms TEXT[];
BEGIN
-- Split the input string into an array of terms
search_terms := string_to_array(search_string, ',');
RETURN QUERY
SELECT pd.place_name, pd.address, pd.ticket, pd.open_close_hour, pd.description
FROM place_destination pd
WHERE EXISTS (
SELECT 1
FROM unnest(search_terms) AS term
WHERE pd.description ILIKE '%' || trim(term) || '%'
OR pd.place_name ILIKE '%' || trim(term) || '%'
)
LIMIT result_limit; -- Use the parameter for the limit
END;
$$ LANGUAGE plpgsql SECURITY INVOKER;
And my workflow