我想基於經緯度和lng值進行查詢,但返回的行與價值存儲爲負值時的查詢不匹配。但是,當我查詢正值它按預期工作。我想知道是否有特定的方式我需要格式化我的查詢。Postgres JSONB:負數查詢
這裏有一些例子查詢證明怪異的結果:
QUERY 1
=======
db_development=# select address from listing where 'address.coords.latitude' < '40';
no rows returned.
QUERY 2
=======
db_development=# select address from listing where 'address.coords.latitude' > '40';
returned address:
{
"city":"Heathmere",
"state":"VIC",
"coords":{
"latitude":-38.19523969999999,
"longitude":141.6158994
},
"number":"1235",
"street":"Princes Highway",
"country":"Australia",
"zipcode":"3305",
"formatted":"Riversleigh, 1235 Princes Hwy, Heathmere VIC 3305, Australia"
}
正如你可以看到我試圖找到行,其中緯度小於40,但沒有返回行。但是,當我檢查大於40時,它將返回緯度爲-38.19523969999999的那一行。
任何幫助表示讚賞。
很好的答案!謝謝 – zlwaterfield