+(defsql sql-right (:symbol "right") (&rest rest)
+ "mssqlserver uses this to get the right n chars of a string"
+ (make-instance 'sql-function-exp
+ :name 'right :args rest))
+
+(defsql sql-nvl (:symbol "nvl") (&rest rest)
+ (if (= (length rest) 2)
+ (make-instance 'sql-function-exp
+ :name 'coalesce :args rest)
+ (error 'sql-user-error :message "NVL accepts exactly 2 arguments.")))
+
+(defsql sql-userenv (:symbol "userenv") (&rest rest)
+ (make-instance 'sql-function-exp
+ :name 'userenv :args rest))
+
+(defsql sql-lower (:symbol "lower") (&rest rest)
+ (if (= (length rest) 1)
+ (make-instance 'sql-function-exp
+ :name 'lower :args rest)
+ (error 'sql-user-error :message "LOWER must have 1 argument.")))
+
+(defsql sql-upper (:symbol "upper") (&rest rest)
+ (if (= (length rest) 1)
+ (make-instance 'sql-function-exp
+ :name 'upper :args rest)
+ (error 'sql-user-error :message "UPPER must have 1 argument.")))
+
+(defsql sql-date_part (:symbol "date_part") (&rest rest)
+ "the date_part function for postgres"
+ (if (= (length rest) 2)
+ (make-instance 'sql-function-exp
+ :name 'date_part :args rest)
+ (error 'sql-user-error :message "date_part must have 2 arguments.")))