Created
January 17, 2019 08:38
-
-
Save dsandip/c80dbccf7c1bcc00384c9d6170e13919 to your computer and use it in GitHub Desktop.
Custom functions: sample function - search_articles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION search_articles(search text) | |
RETURNS SETOF article AS $$ | |
SELECT * | |
FROM article | |
WHERE | |
title ilike ('%' || search || '%') | |
OR content ilike ('%' || search || '%') | |
$$ LANGUAGE sql STABLE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment