Changes between Version 1 and Version 3 of Ticket #31094


Ignore:
Timestamp:
Dec 16, 2019, 4:21:52 AM (5 years ago)
Author:
Johannes Maron
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31094 – Description

    v1 v3  
    55}}}
    66
     7It works fine in Django 2.2.8.
     8
    79Stack:
    810Python 3.8
    911PostgeSQL 11
    1012macOS / Ubuntu latest
     13
     14Full query in 3.0 (pretty)
     15{{{
     16SELECT DISTINCT "camps_offer"."id", "camps_offer"."title", "camps_offer"."slug", "camps_offer"."is_active", "camps_offer"."modified", "camps_offer"."created", "camps_offer"."provider_id", "camps_offer"."activity_type", "camps_offer"."description", "camps_offer"."highlights", "camps_offer"."important_information", "camps_offer"."min_age", "camps_offer"."max_age", "camps_offer"."food", "camps_offer"."video", "camps_offer"."accommodation", "camps_offer"."accommodation_type", "camps_offer"."room_type", "camps_offer"."room_size_min", "camps_offer"."room_size_max", "camps_offer"."external_url", "camps_offer"."application_form", "camps_offer"."caseload", "camps_offer"."field_trips", MIN(T4."retail_price") AS "min_retail_price", (SELECT U0."id" FROM "camps_servicepackage" U0 INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id") WHERE (U0."company_id" = 1 AND U0."option" = "camps_offer"."activity_type" AND ST_Contains(U2."locations", T4."position")) LIMIT 1) AS "in_package", "camps_provider"."id", "camps_provider"."title", "camps_provider"."slug", "camps_provider"."is_active", "camps_provider"."modified", "camps_provider"."created", "camps_provider"."logo", "camps_provider"."description", "camps_provider"."video", "camps_provider"."external_url", "camps_provider"."terms", "camps_provider"."cancellation_policy", "camps_provider"."privacy_policy", "camps_provider"."application_form" FROM "camps_offer" LEFT OUTER JOIN "camps_bookingoption" ON ("camps_offer"."id" = "camps_bookingoption"."offer_id") INNER JOIN "camps_provider" ON ("camps_offer"."provider_id" = "camps_provider"."id") INNER JOIN "camps_bookingoption" T4 ON ("camps_offer"."id" = T4."offer_id") WHERE ("camps_offer"."is_active" = True AND "camps_provider"."is_active" = True AND T4."end" >= STATEMENT_TIMESTAMP() AND T4."is_active" = True AND (SELECT U0."id" FROM "camps_servicepackage" U0 INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id") WHERE (U0."company_id" = 1 AND U0."option" = "camps_offer"."activity_type" AND ST_Contains(U2."locations", T4."position")) LIMIT 1) IS NOT NULL) GROUP BY "camps_offer"."id", "camps_provider"."id" ORDER BY "camps_offer"."created" ASC
     17}}}
     18
     19Full query in 2.2 (pretty)
     20{{{
     21SELECT DISTINCT "camps_offer"."id",
     22                "camps_offer"."title",
     23                "camps_offer"."slug",
     24                "camps_offer"."is_active",
     25                "camps_offer"."modified",
     26                "camps_offer"."created",
     27                "camps_offer"."provider_id",
     28                "camps_offer"."activity_type",
     29                "camps_offer"."description",
     30                "camps_offer"."highlights",
     31                "camps_offer"."important_information",
     32                "camps_offer"."min_age",
     33                "camps_offer"."max_age",
     34                "camps_offer"."food",
     35                "camps_offer"."video",
     36                "camps_offer"."accommodation",
     37                "camps_offer"."accommodation_type",
     38                "camps_offer"."room_type",
     39                "camps_offer"."room_size_min",
     40                "camps_offer"."room_size_max",
     41                "camps_offer"."external_url",
     42                "camps_offer"."application_form",
     43                "camps_offer"."caseload",
     44                "camps_offer"."field_trips",
     45                MIN(T4."retail_price") AS "min_retail_price",
     46                (SELECT U0."id"
     47                 FROM "camps_servicepackage" U0
     48                          INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id")
     49                 WHERE (U0."company_id" = 1 AND U0."option" = ("camps_offer"."activity_type") AND
     50                        ST_Contains(U2."locations", (T4."position")))
     51                 LIMIT 1)              AS "in_package",
     52                "camps_provider"."id",
     53                "camps_provider"."title",
     54                "camps_provider"."slug",
     55                "camps_provider"."is_active",
     56                "camps_provider"."modified",
     57                "camps_provider"."created",
     58                "camps_provider"."logo",
     59                "camps_provider"."description",
     60                "camps_provider"."video",
     61                "camps_provider"."external_url",
     62                "camps_provider"."terms",
     63                "camps_provider"."cancellation_policy",
     64                "camps_provider"."privacy_policy",
     65                "camps_provider"."application_form"
     66FROM "camps_offer"
     67         LEFT OUTER JOIN "camps_bookingoption" ON ("camps_offer"."id" = "camps_bookingoption"."offer_id")
     68         INNER JOIN "camps_provider" ON ("camps_offer"."provider_id" = "camps_provider"."id")
     69         INNER JOIN "camps_bookingoption" T4 ON ("camps_offer"."id" = T4."offer_id")
     70WHERE ("camps_offer"."is_active" = True AND "camps_provider"."is_active" = True AND
     71       T4."end" >= (STATEMENT_TIMESTAMP()) AND T4."is_active" = True AND (SELECT U0."id"
     72                                                                          FROM "camps_servicepackage" U0
     73                                                                                   INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id")
     74                                                                          WHERE (U0."company_id" = 1 AND
     75                                                                                 U0."option" = ("camps_offer"."activity_type") AND
     76                                                                                 ST_Contains(U2."locations", (T4."position")))
     77                                                                          LIMIT 1) IS NOT NULL)
     78GROUP BY "camps_offer"."id",
     79         (SELECT U0."id"
     80          FROM "camps_servicepackage" U0
     81                   INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id")
     82          WHERE (U0."company_id" = 1 AND U0."option" = ("camps_offer"."activity_type") AND
     83                 ST_Contains(U2."locations", (T4."position")))
     84          LIMIT 1), "camps_provider"."id"
     85ORDER BY "camps_offer"."created" ASC
     86}}}
    1187
    1288Full stack trace
Back to Top