when trying to save an SQL view in geoserver that has SQL view parameters sometimes the error message “ERROR: syntax error at or near” is shown.
The reason for this is that the SQL query may be invalid if no default values are provided for the view parameters. In this case, it helps to supply them.
Another reason why this error may occur is that one is trying to save or refresh the view, but the view parameters are not actually enabled. It then helps to activate them by checking the checkbox next to the parameter.