Using PostgreSQL both with (not only) SQL Workbench - how to apply alternate delimiters
I have asked in the SQL Workbench forum and Thomas Kellerer (author of SQL Workbench) helped me. This is a summary of his answer.

First, my sequence was wrong because -- is a comment, but the delimiter must be a valid (not commented out) character or a valid sequence of characters. This makes finding something suitable for a delimiter in SQL Workbench and still not breaking sql code for psql and pgAdmin impossible.

However, there is a workaround: to execute the script through following command:

WbInclude -file=/some/dir/my_function.sql -delimiter=XXXXXX;


That XXXXXX can be anything that is not in the code. This way you can only execute scripts, not edit them, but that's sufficient for me. Currently, there's no better way to operate the code both in and out SQL Workbench.