Skip to content

Commit f5199b7

Browse files
committed
fix: drop old function signatures before recreating with new return type
PostgreSQL's CREATE OR REPLACE cannot change a function's return type. Added DROP FUNCTION IF EXISTS before each CREATE OR REPLACE, matching the pattern used in migration 0050.
1 parent 78a8c7b commit f5199b7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

migrations/tenant/0059-search-functions-user-metadata.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
-- Each function's RETURNS TABLE gains a user_metadata jsonb column,
33
-- and the query bodies include user_metadata in selects.
44
-- Folders return NULL for user_metadata.
5+
--
6+
-- DROP is required because CREATE OR REPLACE cannot change return types.
7+
8+
-- Drop old function signatures (return type is changing)
9+
DO $$ BEGIN DROP FUNCTION IF EXISTS storage.list_objects_with_delimiter(text,text,text,integer,text,text,text); EXCEPTION WHEN OTHERS THEN NULL; END; $$;
10+
DO $$ BEGIN DROP FUNCTION IF EXISTS storage.search(text,text,integer,integer,integer,text,text,text); EXCEPTION WHEN OTHERS THEN NULL; END; $$;
11+
DO $$ BEGIN DROP FUNCTION IF EXISTS storage.search_v2(text,text,integer,integer,text,text,text,text); EXCEPTION WHEN OTHERS THEN NULL; END; $$;
12+
DO $$ BEGIN DROP FUNCTION IF EXISTS storage.search_by_timestamp(text,text,integer,integer,text,text,text,text); EXCEPTION WHEN OTHERS THEN NULL; END; $$;
513

614
-- ============================================================================
715
-- list_objects_with_delimiter: Add user_metadata support

0 commit comments

Comments
 (0)