postgresql: enum and character varying, updating

前端 未结 3 1671
孤城傲影
孤城傲影 2021-01-06 17:17

I have the ENUM type in postgresql

CREATE TYPE user_state AS ENUM (\'unconfirmed\', \'locked\', \'active\');
<         


        
3条回答
  •  甜味超标
    2021-01-06 17:57

    Very late to the party here, but I would like to add that in this specific case it is enough to simply cast the varchar to text to prevent recursion.

    CREATE FUNCTION dummy_cast(varchar) RETURNS t_tl AS $$
        SELECT ('' || $1)::t_tl;
    $$ LANGUAGE SQL;
    

提交回复
热议问题