Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find empty strings or strings containing only whitespace, for postgresql
CREATE OR REPLACE FUNCTION empty(TEXT)
RETURNS bool AS
$$ SELECT $1 ~ '^[[:space:]]*$'; $$
LANGUAGE sql
IMMUTABLE;
COMMENT ON FUNCTION empty(TEXT)
IS 'Find empty strings or strings containing only whitespace';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.