Skip to content

Instantly share code, notes, and snippets.

@programisti
Created May 23, 2020 17:09
Show Gist options
  • Save programisti/6eccd9ac5e87b5af7489015e0eb47441 to your computer and use it in GitHub Desktop.
Save programisti/6eccd9ac5e87b5af7489015e0eb47441 to your computer and use it in GitHub Desktop.
-- FUNCTION: api.search_job(character varying, integer, integer, integer)
-- DROP FUNCTION api.search_job(character varying, integer, integer, integer);
CREATE OR REPLACE FUNCTION api.search_job(
keyword character varying,
rategt integer,
ratelt integer,
session integer)
RETURNS api.job
LANGUAGE 'sql'
COST 100
STABLE SECURITY DEFINER
AS $BODY$
SELECT * FROM api.job
WHERE
(title LIKE '%' || keyword || '%' or text LIKE '%'|| keyword ||'%') and
session = session and
rate >= rateGt and
rate <= rateLt and
status = 'active';
$BODY$;
ALTER FUNCTION api.search_job(character varying, integer, integer, integer)
OWNER TO postgres;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment