How do I call pgroonga query in rpc #3650
-
function CREATE OR REPLACE FUNCTION search_books(
keywords text
) RETURNS SETOF books AS $$
BEGIN
IF keywords IS NULL OR keywords = '' THEN
RETURN QUERY SELECT * from books;
ELSE
RETURN QUERY SELECT * from books WHERE name &@~ keywords;
END IF;
END;
$$ LANGUAGE plpgsql; It works in sql editor like When using the client, the call failed. client.rpc('search_books', { keywords: '' }); // OK
client.rpc('search_books', { keywords: 'abc' }); // FAIL
|
Beta Was this translation helpful? Give feedback.
Answered by
wolfgangwalther
Jul 10, 2024
Replies: 2 comments
-
You probably need to do either:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
minosss
-
Thanks. -- current
show search_path;
-- .. extensions
-- pgroonga is installed by default in extensions
-- works
RETURN QUERY SELECT * from books WHERE name OPERATOR(extensions.&@~) keywords; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You probably need to do either:
db-extra-search-path
OPERATOR(<pgroonga schem>.&@~)