Need help - Syntax error at or near select
# help
j
Need help - Syntax error at or near select
I am trying to create a new function (search function), but I get syntax error at or near "select" and I don't know why... create or replace function searchCategories(recherche text) returns setof categories as $$ select * from categories where to_tsvector(titre_fr || ' ' || titre_cn) @@ to_tsquery(recherche); $$ language plpgsql;
g
try putting a begin and end before select and before $$
j
Thank you!
Would you happen to know why I get ' type " " does not exist' on some queries?
g
not without more info... normally setof must exactly match the table structure, but with * on your select not sure why that would be an issue.