I am trying to add layer through SQL VIEW GeoServer.

Everything is fine just, GeoServer is not able to take some chars correctly.

When name parameter includes dash "-" character, the WMS not able to show layer on map.

Query: select * from public."MyLayer" where name like '%%name%'

In PostgreSQL, the query is working, but in SQL, view it does not show.

1 Answer 1


To prevent SQL injection attacks there is a validation regular expression that is used to check if a parameter is acceptable. By default this is ^[\w\d\s]+$ which means that only "word characters ([a-zA-Z_0-9])", digits and white space are allowed. So if your name contains a - it is rejected.

You need to add - into the validation check (this is a little tricky because - is a special character) so change it to something like ^[-\w\d\s]+$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.