Hi,
I have made a quick test on the UI and I cannot seem to set the "escapeSql"
to true... have you tried flipping that switch off?
It caught my attention because I did not remember about it, and indeed I
was not the one to add that functionality.

Cheers
Andrea

On Wed, Feb 8, 2017 at 9:00 PM, David Haynes II <dahay...@umn.edu> wrote:

> Hello everyone,
>
> I guess this is more a question about how the REST API is functioning and
> if it is perhaps submitting information straight to PosgreSQL instead of
> encountering the java layer first and allowing it to submit to PostgreSQL
>
> Here is a JSON request that does not work
> This sql is buried in there...
> "sql": "select gi_id::text || '_3'::text as fake_id, gi_id AS id,
> short_label, geom_3, feat_label, 3 as zoom from
> terrascope.sgl_boundaries_view where sgl_id = %sgl_id%"
>
> {"featureType": {"name": "sgl_boundaries_view_3", "nativeName":
> "sgl_boundaries_view_3", "namespace": {"name": "sgl_demo", "href": "
> http://localhost/geoserver/rest/workspaces/sgl_demo"}, "title":
> "sgl_boundaries_view_3", "abstract": "The boundaries of the world.",
> "keywords": {"string": ["sgl_boundaries_view_3", "features"]}, "nativeCRS":
> "GEOGCS[WGS 84, DATUM[World Geodetic System 1984, SPHEROID[WGS 84,
> 6378137.0, 298.257223563, AUTHORITY[EPSG,7030]], AUTHORITY[EPSG,6326]],
>  PRIMEM[Greenwich, 0.0, AUTHORITY[EPSG,8901]],  UNIT[degree,
> 0.017453292519943295],  AXIS[Geodetic longitude, EAST],  AXIS[Geodetic
> latitude, NORTH], AUTHORITY[EPSG,4326]]", "srs": "EPSG:4326",
> "nativeBoundingBox": {"minx": -180, "maxx": 180, "miny": -90, "maxy": 90,
> "crs": "EPSG:4326"}, "latLonBoundingBox": {"minx": -180, "maxx": 180,
> "miny": -90, "maxy": 90, "crs": "GEOGCS[WGS84(DD),  DATUM[WGS84,
>  SPHEROID[WGS84, 6378137.0, 298.257223563]],  PRIMEM[Greenwich, 0.0],
>  UNIT[degree, 0.017453292519943295],  AXIS[Geodetic longitude, EAST],
>  AXIS[Geodetic latitude, NORTH]]"}, "projectionPolicy": "FORCE_DECLARED",
> "enabled": true, "metadata": {"entry": {"@key": "JDBC_VIRTUAL_TABLE",
> "virtualTable": {"name": "sgl_boundaries_view_3", "sql": "select
> gi_id::text || '_3'::text as fake_id, gi_id AS id, short_label, geom_3,
> feat_label, 3 as zoom from terrascope.sgl_boundaries_view where sgl_id =
> %sgl_id%", "escapeSql": true, "keyColumn": "fake_id", "geometry": {"name":
> "geom_3", "type": "MultiPolygon", "srid": 4326, "parameter":
> {"defaultValue": 58, "regexpValidator": "^[\\w\\d\\s]+$", "name":
> "sgl_id"}}}}}, "store": {"@class": "dataStore", "name":
> "current_demo_database", "href": "https://localhost/geoserver/
> rest/workspaces/sgl_demo/datastores/current_demo_database.json"},
> "maxFeatures": 0, "numDecimals": 0, "overridingServiceSRS": false,
> "skipNumberMatched": false, "circularArcPresent": false, "attributes":
> {"attribute": [{"name": "id", "minOccurs": 0, "maxOccurs": 1, "nillable":
> true, "binding": "java.lang.Integer"}, {"name": "short_label", "minOccurs":
> 0, "maxOccurs": 1, "nillable": true, "binding": "java.lang.String"},
> {"name": "geom_3", "minOccurs": 0, "maxOccurs": 1, "nillable": true,
> "binding": "com.vividsolutions.jts.geom.MultiPolygon"}, {"name":
> "feat_label", "minOccurs": 0, "maxOccurs": 1, "nillable": true, "binding":
> "java.lang.String"}, {"name": "zoom", "minOccurs": 0, "maxOccurs": 1,
> "nillable": true, "binding": "java.lang.Integer"}]}}}
>
> If I submit this as it is, I will get a postgresql error, for encountering
> the "%"
> If I remove the  "%"  around "sgl_id" when submitting this view will be
> created but without the sql view parameters which have to be done manually.
>
> On Wed, Feb 8, 2017 at 1:12 PM, Andrea Aime <andrea.a...@geo-solutions.it>
> wrote:
>
>> On Wed, Feb 8, 2017 at 8:03 PM, David Haynes II <dahay...@umn.edu> wrote:
>>
>>> I will try switching it to xml and see how that works. Are you sure the
>>> REST isn't skipping the java layer and submitting directly to PostgreSQL?
>>>
>>
>> Hum... I did not write the REST api, but I cannot see how it might submit
>> direclty to postgresql, makes no sense.
>> Can you also share the request you're sending over?
>>
>> Ah, please keep the messages on the list (part of the list etiquette, see
>> the full document here:
>> http://geoserver.org/comm/userlist-guidelines.html )
>>
>> Cheers
>> Andrea
>>
>> --
>> ==
>> GeoServer Professional Services from the experts! Visit
>> http://goo.gl/it488V for more information.
>> ==
>>
>> Ing. Andrea Aime
>> @geowolf
>> Technical Lead
>>
>> GeoSolutions S.A.S.
>> Via di Montramito 3/A
>> 55054  Massarosa (LU)
>> phone: +39 0584 962313 <+39%200584%20962313>
>> fax: +39 0584 1660272 <+39%200584%20166%200272>
>> mob: +39  339 8844549 <+39%20339%20884%204549>
>>
>> http://www.geo-solutions.it
>> http://twitter.com/geosolutions_it
>>
>> *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
>>
>> Le informazioni contenute in questo messaggio di posta elettronica e/o
>> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
>> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
>> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
>> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
>> darcene notizia via e-mail e di procedere alla distruzione del messaggio
>> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
>> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
>> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
>> principi dettati dal D.Lgs. 196/2003.
>>
>>
>>
>> The information in this message and/or attachments, is intended solely
>> for the attention and use of the named addressee(s) and may be confidential
>> or proprietary in nature or covered by the provisions of privacy act
>> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
>> Code).Any use not in accord with its purpose, any disclosure, reproduction,
>> copying, distribution, or either dissemination, either whole or partial, is
>> strictly forbidden except previous formal approval of the named
>> addressee(s). If you are not the intended recipient, please contact
>> immediately the sender by telephone, fax or e-mail and delete the
>> information in this message that has been received in error. The sender
>> does not give any warranty or accept liability as the content, accuracy or
>> completeness of sent messages and accepts no responsibility  for changes
>> made after they were sent or for other risks which arise as a result of
>> e-mail transmission, viruses, etc.
>>
>> -------------------------------------------------------
>>
>
>
>
> --
> David Haynes, Ph.D.
> Research Associate Terra Populus
> Minnesota Population Center
> 612-626-3933 <(612)%20626-3933>
> www.terrapop.org
>



-- 
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility  for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to