-- Create a composite B-tree index for filtering if it doesn't exist
index_name_filter:='idx_filter_'||schema_name;
EXECUTEformat('CREATE INDEX IF NOT EXISTS %I ON %I."searchable_column_values" (database_name, schema_name, table_name, column_name);',index_name_filter,schema_name);
-- Create a unique index for the combination of value and identifiers if it doesn't exist
EXECUTEformat('CREATE UNIQUE INDEX IF NOT EXISTS %I ON %I."searchable_column_values" (value, database_name, schema_name, table_name, column_name);',index_name_unique,schema_name);
ENDLOOP;
RAISENOTICE'Finished backfill of stored value schemas.';