timescale/promscale_extension

format with operators with % in name fails

jgpruitt opened this issue · 0 comments

We have a number of new operators which start with the % character. There are a number of code snippets that use format to construct an ALTER OPERATOR statement. Unfortunately, this fails because format uses % as a placeholder for variables. We need to escape the % using %%.

EXCEPTION
    WHEN SQLSTATE '42723' THEN -- operator already exists
        EXECUTE format($q$ALTER OPERATOR ps_trace.%<=(_ps_trace.tag_v, _ps_trace.tag_v) OWNER TO %I$q$, current_user);
END;