1

I can not get it to work. I started with complex sql and ended with 'hello word' example, but I get errors: My sqls are:

  • SELECT t.id, t.user_id, t.coordinates, t.size, t.price FROM my_table t WHERE t.id=%id_param% Error: Failed to create SQL view: ERROR: syntax error at or near ")" Position: 100
  • SELECT t.id, t.user_id, t.coordinates, t.size, t.price FROM my_table t WHERE t.id='%id_param%' Error: Failed to create SQL view: ERROR: invalid input syntax for integer: "" Position: 100

I am not sure, what I am missing. I am using approx 2 months old OpenGeo suite (4.0.2).

About GeoServer General information about GeoServer Build Information Version 2.4-SNAPSHOT Git Revision f295d37d70c3b1f0e51942e8b031253e4d75459 Build Date 20-Jan-2014 22:29 GeoTools Version 10-SNAPSHOT (rev 3bb3df4f410750baf9ebc48c9c475a70642aadb6) GeoWebCache Version 1.5.0 (rev 1.5.x/f981cafd349886bb2a1ef45067f26b1aa8e4aff4)

asked Apr 26, 2014 at 19:51

2 Answers 2

3

Have you set a Default value for the id_param under the SQL view parameters section? Try using your first query (without the quotes) and entering 0 for under the default value

answered May 8, 2014 at 12:19
1
  • OMG. Simple but obscure... Commented Jan 6, 2023 at 10:25
0

Perhaps you are missing the select syntax with "like" as described in this post

answered Apr 29, 2014 at 7:52
5
  • LIKE for interger field? Commented Apr 30, 2014 at 10:07
  • you have never told us that "id_param" was a integer field. I edited my answer. Commented May 3, 2014 at 19:36
  • I though that is logic based on field name. Commented May 4, 2014 at 13:04
  • Does the syntax work in pgadmin or psql? Commented May 5, 2014 at 7:10
  • Yes it does work in pgadmin, but not geoserver. Commented May 5, 2014 at 19:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.