diff --git a/doc/sql/query.ebnf b/doc/sql/query.ebnf
index 43f63ce708fd67cfeefc44985f18c0ed58b008e0..cb3afc84d40ef999fdb78ce087ec903000452747 100644
--- a/doc/sql/query.ebnf
+++ b/doc/sql/query.ebnf
@@ -27,6 +27,7 @@ expression  ::= ('NOT'* (
                     | to_char
                     | to_date
                     | trim
+                    | substr
                     | '(' expression ')'
                     | 'NOT'? 'EXISTS' '(' (query | values) ')'
                     | '(' (query | values) ')'
@@ -53,6 +54,7 @@ to_date     ::= 'TO_DATE' '(' expression ',' format ')'
 trim        ::= 'TRIM' '('
                 ((('LEADING' | 'TRAILING' | 'BOTH')? removal_chars
                 | ('LEADING' | 'TRAILING' | 'BOTH')) 'FROM')? string ')'
+substr      ::= 'SUBSTR' '(' string ',' from (',' count)? ')'
 values      ::= 'VALUES'
                 ('(' (expression(',' expression)*) ')')
                 (',' ('(' (expression(',' expression)*) ')'))*
diff --git a/sbroad-core/src/executor/engine.rs b/sbroad-core/src/executor/engine.rs
index 0dbc790495826db9c0c2738b182b0f8dd837e62a..9cdafb074a49f7a930eb271904e8b4fd7db36676 100644
--- a/sbroad-core/src/executor/engine.rs
+++ b/sbroad-core/src/executor/engine.rs
@@ -77,6 +77,7 @@ pub fn get_builtin_functions() -> &'static [Function] {
             vec![
                 Function::new_stable("\"TO_DATE\"".into(), Type::Datetime),
                 Function::new_stable("\"TO_CHAR\"".into(), Type::String),
+                Function::new_stable("\"SUBSTR\"".into(), Type::String),
             ]
         })
     }