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)
2 Answers 2
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
-
OMG. Simple but obscure...Auspex– Auspex2023年01月06日 10:25:44 +00:00Commented Jan 6, 2023 at 10:25
Perhaps you are missing the select syntax with "like" as described in this post
-
-
you have never told us that "id_param" was a integer field. I edited my answer.MickyInTheSky– MickyInTheSky2014年05月03日 19:36:29 +00:00Commented May 3, 2014 at 19:36
-
I though that is logic based on field name.Makla– Makla2014年05月04日 13:04:36 +00:00Commented May 4, 2014 at 13:04
-
Does the syntax work in pgadmin or psql?MickyInTheSky– MickyInTheSky2014年05月05日 07:10:07 +00:00Commented May 5, 2014 at 7:10
-
Yes it does work in pgadmin, but not geoserver.Makla– Makla2014年05月05日 19:13:19 +00:00Commented May 5, 2014 at 19:13