我正在使用Heroku开发一个应用程序,但他们没有为Postgres加载plpgsql语言,这在尝试运行以下内容时会导致问题:
CREATE FUNCTION profiles_search_trigger() RETURNS trigger AS $$
begin
new.search_vector :=
setweight(to_tsvector('pg_catalog.english', coalesce(new.display_name,'')), 'A') ||
setweight(to_tsvector('pg_catalog.english', coalesce(new.about,'')), 'B') ||
setweight(to_tsvector('pg_catalog.english', coalesce(new.music_education,'')), 'D') ||
setweight(to_tsvector('pg_catalog.english', coalesce(new.other_experience,'')), 'D') ||
setweight(to_tsvector('pg_catalog.english', coalesce(new.favourite_artists,'')), 'D');
return new;
end
$$ LANGUAGE plpgsql;
我怎样才能使用标准SQL而不是plpgsql重写它?