You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
coalesce(placementtype_agg.placementtypes, '{}') AS placementtypes,
46
46
place_pa.placementenvironment,
47
-
placetype.item AS placetype,
47
+
coalesce(placetype_agg.placetypes, '{}') AS placetypes,
48
48
placeowner.owner AS placeowner,
49
49
placeowner.ownershipnote,
50
50
placeowner.ownertype,
@@ -140,9 +140,23 @@ LEFT JOIN (
140
140
) movement ON movement.objectcsid = hier.name AND movement.currentlocation = obj.computedcurrentlocation
141
141
-- place and all place fields
142
142
LEFT JOIN places_common place on place.refname = obj.computedcurrentlocation
143
-
LEFT JOIN places_publicart_placementtypes placement on placement.id = place.id AND placement.pos = 0
143
+
-- AGGREGATE ALL PLACEMENTTYPES
144
+
LEFT JOIN (
145
+
SELECT
146
+
placementtypes.id AS place_id,
147
+
array_agg(placementtypes.item) AS placementtypes
148
+
FROM places_publicart_placementtypes placementtypes
149
+
GROUP BY placementtypes.id
150
+
) placementtype_agg ON placementtype_agg.place_id = place.id
144
151
LEFT JOIN places_publicart place_pa on place_pa.id = place.id
145
-
LEFT JOIN places_publicart_publicartplacetypes placetype on placetype.id = place.id AND placetype.pos = 0
152
+
-- AGGREGATE ALL PLACETYPES
153
+
LEFT JOIN (
154
+
SELECT
155
+
placetype.id AS place_id,
156
+
array_agg(placetype.item) AS placetypes
157
+
FROM places_publicart_publicartplacetypes placetype
158
+
GROUP BY placetype.id
159
+
) placetype_agg ON placetype_agg.place_id = place.id
146
160
LEFT JOIN hierarchy placeowner_hier on placeowner_hier.parentid = place.id and placeowner_hier.primarytype = 'publicartPlaceOwnerGroup' and placeowner_hier.pos = 0
147
161
LEFT JOIN hierarchy placeownerdate_hier on placeownerdate_hier.parentid = placeowner_hier.id
148
162
LEFT JOIN publicartplaceownergroup placeowner on placeowner.id = placeowner_hier.id
coalesce(placementtype_agg.placementtypes, '{}') AS placementtypes,
46
46
place_pa.placementenvironment,
47
-
placetype.item AS placetype,
47
+
coalesce(placetype_agg.placetypes, '{}') AS placetypes,
48
48
placeowner.owner AS placeowner,
49
49
placeowner.ownershipnote,
50
50
placeowner.ownertype,
@@ -140,9 +140,23 @@ LEFT JOIN (
140
140
) movement ON movement.objectcsid = hier.name AND movement.currentlocation = obj.computedcurrentlocation
141
141
-- place and all place fields
142
142
LEFT JOIN places_common place on place.refname = obj.computedcurrentlocation
143
-
LEFT JOIN places_publicart_placementtypes placement on placement.id = place.id AND placement.pos = 0
143
+
-- AGGREGATE ALL PLACEMENTTYPES
144
+
LEFT JOIN (
145
+
SELECT
146
+
placementtypes.id AS place_id,
147
+
array_agg(placementtypes.item) AS placementtypes
148
+
FROM places_publicart_placementtypes placementtypes
149
+
GROUP BY placementtypes.id
150
+
) placementtype_agg ON placementtype_agg.place_id = place.id
144
151
LEFT JOIN places_publicart place_pa on place_pa.id = place.id
145
-
LEFT JOIN places_publicart_publicartplacetypes placetype on placetype.id = place.id AND placetype.pos = 0
152
+
-- AGGREGATE ALL PLACETYPES
153
+
LEFT JOIN (
154
+
SELECT
155
+
placetype.id AS place_id,
156
+
array_agg(placetype.item) AS placetypes
157
+
FROM places_publicart_publicartplacetypes placetype
158
+
GROUP BY placetype.id
159
+
) placetype_agg ON placetype_agg.place_id = place.id
146
160
LEFT JOIN hierarchy placeowner_hier on placeowner_hier.parentid = place.id and placeowner_hier.primarytype = 'publicartPlaceOwnerGroup' and placeowner_hier.pos = 0
147
161
LEFT JOIN hierarchy placeownerdate_hier on placeownerdate_hier.parentid = placeowner_hier.id
148
162
LEFT JOIN publicartplaceownergroup placeowner on placeowner.id = placeowner_hier.id
0 commit comments