-(defsql sql-|| (:symbol "||") (&rest rest)
- (make-instance 'sql-relational-exp
- :operator '|| :sub-expressions rest))
+(defsql sql-concat-op (:symbol "concat-op") (&rest rest)
+ (make-instance 'sql-relational-exp
+ :operator '\|\| :sub-expressions rest))
+
+(defsql sql-concat (:symbol "concat") (&rest rest)
+ (make-instance 'sql-function-exp
+ :name 'concat :args rest))
+
+(defsql sql-substr (:symbol "substr") (&rest rest)
+ (if (= (length rest) 3)
+ (make-instance 'sql-function-exp
+ :name 'substr :args rest)
+ (error 'sql-user-error :message "SUBSTR must have 3 arguments.")))
+
+(defsql sql-substring (:symbol "substring") (&rest rest)
+ (if (= (length rest) 3)
+ (make-instance 'sql-function-exp
+ :name 'substring :args rest)
+ (error 'sql-user-error :message "SUBSTRING must have 3 arguments.")))