Skip to content

Commit

Permalink
Bug fix - invalid SQL
Browse files Browse the repository at this point in the history
It seems some versions of PostgreSQL were tolerant of a missing space
after a parameter
  • Loading branch information
frankdean committed Oct 13, 2023
1 parent e7c0137 commit b8bab34
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/itinerary_pg_dao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ std::vector<ItineraryPgDao::route>
"LEFT JOIN path_color rc ON r.color=rc.key "
"LEFT JOIN itinerary_route_point p ON r.id=p.itinerary_route_id "
"LEFT JOIN itinerary_sharing sh "
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1"
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1 "
"WHERE i.archived != true AND (i.user_id=$1 OR (sh.active AND sh.shared_to_id=$1)) "
"AND r.itinerary_id = $2 AND r.id=ANY($3) "
"ORDER BY r.id, p.id",
Expand Down Expand Up @@ -640,7 +640,7 @@ std::vector<ItineraryPgDao::route>
"LEFT JOIN path_color rc ON r.color=rc.key "
"LEFT JOIN itinerary_route_point p ON r.id=p.itinerary_route_id "
"LEFT JOIN itinerary_sharing sh "
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1"
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1 "
"WHERE i.archived != true AND (i.user_id=$1 OR (sh.active AND sh.shared_to_id=$1)) "
"AND r.itinerary_id = $2 "
"ORDER BY r.id, p.id",
Expand Down Expand Up @@ -721,7 +721,7 @@ std::vector<ItineraryPgDao::track>
"LEFT JOIN itinerary_track_segment ts ON t.id=ts.itinerary_track_id "
"LEFT JOIN itinerary_track_point p ON ts.id=p.itinerary_track_segment_id "
"LEFT JOIN itinerary_sharing sh "
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1"
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1 "
"WHERE i.archived != true AND (i.user_id=$1 OR (sh.active AND sh.shared_to_id=$1)) "
"AND t.itinerary_id=$2 AND t.id=ANY($3) ORDER BY t.id, ts.id, p.id";
// std::cout << "SQL: \n" << sql << '\n' << "track ids: " << ids_sql << '\n';
Expand Down Expand Up @@ -820,7 +820,7 @@ std::vector<ItineraryPgDao::track>
"LEFT JOIN itinerary_track_segment ts ON t.id=ts.itinerary_track_id "
"LEFT JOIN itinerary_track_point p ON ts.id=p.itinerary_track_segment_id "
"LEFT JOIN itinerary_sharing sh "
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1"
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1 "
"WHERE i.archived != true AND (i.user_id=$1 OR (sh.active AND sh.shared_to_id=$1)) "
"AND t.itinerary_id=$2 ORDER BY t.id, ts.id, p.id";
// std::cout << "SQL: \n" << sql << '\n';
Expand Down Expand Up @@ -927,7 +927,7 @@ std::vector<ItineraryPgDao::waypoint>
"FROM itinerary_waypoint w "
"JOIN itinerary i ON i.id=w.itinerary_id "
"LEFT JOIN itinerary_sharing sh "
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1"
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1 "
"WHERE i.archived != true AND (i.user_id=$1 OR (sh.active AND sh.shared_to_id=$1)) "
"AND w.itinerary_id=$2 AND w.id=ANY($3) "
"ORDER BY name, symbol, id",
Expand Down Expand Up @@ -972,7 +972,7 @@ std::vector<ItineraryPgDao::waypoint>
"FROM itinerary_waypoint w "
"JOIN itinerary i ON i.id=w.itinerary_id "
"LEFT JOIN itinerary_sharing sh "
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1"
"ON sh.itinerary_id=$2 AND sh.shared_to_id=$1 "
"WHERE i.archived != true AND (i.user_id=$1 OR (sh.active AND sh.shared_to_id=$1)) "
"AND w.itinerary_id=$2"
"ORDER BY name, symbol, id",
Expand Down

0 comments on commit b8bab34

Please sign in to comment.