LACMTA / metro-api-v2

Docs: https://lacmta.github.io/metro-api-v2/ Dev: https://dev-metro-api-v2.ofhq3vd1r7une.us-west-2.cs.amazonlightsail.com/docs
https://lacmta.github.io/metro-api-v2/
0 stars 3 forks source link

Some lines throwing Internal Server Error #462

Closed matikin9 closed 8 months ago

matikin9 commented 8 months ago

Examples:

image

albertkun commented 8 months ago

Fixed: this was an issue with the rows being duplicated in the database, so the endpoint did not know which one to return.

image

Edit: here is the postgresql command used to solve this:

DELETE FROM route_stops_grouped
WHERE ctid NOT IN (
  SELECT ctid
  FROM (
    SELECT DISTINCT ON (route_code) ctid
    FROM route_stops_grouped
    ORDER BY route_code, ctid
  ) subquery
);