How to create text search configuration but only when it doesn't exists? For instance, like the other create statements:
CREATE TEXT SEARCH CONFIGURATION IF NOT EXISTS text_without_accent (COPY = simple);
How to create text search configuration but only when it doesn't exists? For instance, like the other create statements:
CREATE TEXT SEARCH CONFIGURATION IF NOT EXISTS text_without_accent (COPY = simple);
使用DO语句并捕获错误:
DO
$$BEGIN
CREATE TEXT SEARCH CONFIGURATION ...
EXCEPTION
WHEN unique_violation THEN
NULL; -- ignore error
END;$$;
先删除它,然后再创建它:
DROP TEXT SEARCH CONFIGURATION IF EXISTS text_without_accent cascade;
CREATE TEXT SEARCH CONFIGURATION text_without_accent (COPY = simple);