【发布时间】:2015-02-13 08:38:42
【问题描述】:
我正在使用 wso2dss 3.0.0。我正在尝试执行 postgresql 查询,即
SELECT addressid, geocode
FROM maddress
WHERE geocode::point <@ circle '((18.9750,72.8258), 5)';
它在 PostgreSQL 中运行良好。当我在 wso2dss 中使用相同的查询时,即
SELECT addressid, geocode
FROM maddress
WHERE geocode::point <@ circle '((?,?), ?)';
它给了我这样的错误:
DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: Geofence_DataService
Location: /Geofence_DataService.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: adding_geofence_op
Current Params: {longitude=72.8258, radius=4, latitude=18.9750}
Nested Exception:-
DS Fault Message: Error in 'createProcessedPreparedStatement'
DS Code: UNKNOWN_ERROR
Nested Exception:-
org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.
如果我删除圆圈的" ' "(引号) 那么它也不会执行。查询''看起来像这样:
选择地址ID,地理编码 发件人地址 WHERE geocode::point
它会给出以下错误:
Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: Geofence_DataService
Location: /Geofence_DataService.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: geofence_op
Current Params: {longitude=72.8258, radius=4, latitude=18.9750}
Nested Exception:-
org.postgresql.util.PSQLException: ERROR: function circle(record, double precision) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type cast
但是circle是PostgreSQL内置的地理函数,那有必要写显式函数吗?否则确切的错误在哪里?即使我在 PostgreSQL 中执行时使用输入参数输入查询,它也可以正常工作。如果是这样,那么为什么它不接受动态参数?请告诉我..
【问题讨论】:
-
我不知道 wso2dss 但问题似乎是如何将参数拼接到定义圆的字符串中。不带引号的第二个选项是完全错误的,因为现在 PostgreSQL 将
circle ( ... )视为一个没有足够模式的函数。从 wso2dss 查看参数是如何放入查询中的。 -
是的..并且 wso2dss 无法接受功能..这就是问题
标签: postgresql wso2dss