Skip to content

Instantly share code, notes, and snippets.

@jheidt
Forked from xenoterracide/empty.sql
Created October 26, 2015 22:56
Show Gist options
  • Select an option

  • Save jheidt/32df7bf593bbb9b0b2bd to your computer and use it in GitHub Desktop.

Select an option

Save jheidt/32df7bf593bbb9b0b2bd to your computer and use it in GitHub Desktop.

Revisions

  1. @xenoterracide xenoterracide created this gist Jan 19, 2010.
    7 changes: 7 additions & 0 deletions empty.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    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';