Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
658 views
in Technique[技术] by (71.8m points)

postgresql - Why am I getting a "[42883] ERROR: operator does not exist: unknown + text" response?

I have a very simple function that accepts _posttypeid and _url as parameters:

CREATE FUNCTION rewrite(_postid integer DEFAULT NULL::integer,
                                       _url character varying DEFAULT NULL::character varying)
    RETURNS TABLE
            (
                DestinationURL             varchar,
            )
    LANGUAGE plpgsql
AS
$function$
BEGIN
RETURN QUERY
                SELECT 
                NULL AS PostTypeID,
                _url      AS DestinationURL,
                      
                FROM reference.destinations dest1
            
                WHERE length(TRIM(dest1.DestinationURL)) > 0
                AND _url LIKE '%' + TRIM(dest1.DestinationURL)) + '%'
                ORDER BY length(dest1.DestinationURL)) DESC
                LIMIT 1;
END;
$function$

If I run select * from public.rewrite(_url := 'wikipedia.org') then I get this error:

[42883] ERROR: operator does not exist: unknown + text

Hint: No operator matches the given name and argument types. You might need to add explicit type casts.

I am clearly passing in text as the value for the _url paramater. I don't understand what the error means or how to go about fixing it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...