2017-09-14 2 views
0

Dieses mich treibt verrückt. Die folgende Abfrage funktioniert ganz lokal in Ordnung, aber versagt, wenn ich es auf travis-ci testen und wirft die Fehler:Postgresql Abfrage funktioniert lokal, aber nicht auf Travis CI

java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: syntax error at or near "select" Position: 39

Hoffentlich jemand etwas sehen kann ich nicht.

Hier meine Tabellen sind:

+----------+---------------+ 
| ways     | 
+----------+---------------+ 
| way_id | bigint  | 
| node_ids | bigint array | 
| rep_lat | float(9)  | 
| rep_lon | float(9)  | 
+----------+---------------+ 

+---------+-----------+ 
| nodes    | 
+---------+-----------+ 
| node_id | bigint | 
| lat  | float(9) | 
| lon  | float(9) | 
+---------+-----------+ 

Hier ist meine Frage:

update ways 
set (rep_lat, rep_lon) = 
    ( 
    select lat, lon 
    from nodes 
    where nodes.node_id = ways.node_ids[array_length(ways.node_ids, 1)/2] 
) 

Antwort

0

Schräge, aus welchem ​​Grund, dieses Format war akzeptabel:

UPDATE ways 
SET rep_lat=subq.lat, rep_lon=subq.lon 
FROM (SELECT lat, lon, node_id FROM nodes) as subq 
WHERE subq.node_id = ways.node_ids[array_length(ways.node_ids, 1)/2] 
Verwandte Themen