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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…