Hi Mike ! Here is the function : create or repl...
# javascript
p
Hi Mike ! Here is the function : create or replace function search_posts(keyword text) returns table(vehicules record) as $func$ select * from vehicules where to_tsvector(constructeur || ' ' || nom_propulsion || ' ' || nom) -- concat columns, but be sure to include a space to separate them! @@ to_tsquery(keyword); $func$ language sql; when i run the SQL command i get a success response
g
Usually when I have hit that it is because the parameters calling don't exactly match those defined in the function. It is considered a different function if number or type of parameters is different
p
ok i'll try to type it then 🙂
Thanks, i'll let you know
Hi tried with a type varchar and text, but it's the same response. And i'm sure that i pass a string as you can see 🙂 const getVehicules = async (input: String) => { let { data, error } = await supabase.rpc('search_posts', { input }); console.error(error); console.log(data); }; getVehicules('berlingo');
m
You need to use keyword instead of input
The function parameters need to be map by name.
p
Yes i changed from input to keyword and i don't have this error anymore. but i have a new one now 😄 a column definition list is required for functions returning "record" How come is it so hard to do a simple text search on 2 columns ! 😄