rimashah25 commented on a change in pull request #5307:
URL: https://github.com/apache/trafficcontrol/pull/5307#discussion_r527904271



##########
File path: traffic_ops/traffic_ops_golang/dbhelpers/db_helpers.go
##########
@@ -1009,3 +1010,49 @@ GROUP BY t.name, ds.topology
        }
        return dsType, reqCap, topology, true, nil
 }
+
+// CheckOriginServerInCacheGroupTopology checks if a DS has ORG server and if 
it does, to make sure the cachegroup is part of DS
+func CheckOriginServerInCacheGroupTopology(tx *sql.Tx, dsID int, dsTopology 
string) (error, error, int) {
+       // get servers and respective cachegroup name that have ORG type in a 
delivery service
+       q := `
+               SELECT s2.host_name, c.name 
+               FROM server s2
+                       INNER JOIN deliveryservice_server ds ON ds.server = 
s2.id
+                       inner join type t on t.id = s2.type
+                       INNER JOIN cachegroup c ON c.id = s2.cachegroup
+               WHERE ds.deliveryservice=$1 and t.name='ORG'
+               GROUP BY s2.host_name, c.name

Review comment:
       This was the error I used to get 
   trafficops_1       | ERROR: api.go:209: 2020-11-17T22:26:29.8697024Z: 
172.16.239.1:47762 querying deliveryservice origin server: pq: column "c.name" 
must appear in the GROUP BY clause or be used in an aggregate function
   trafficops_1       | DEBUG: api.go:214: 2020-11-17T22:26:29.869793Z: 
Internal Server Error
   
   but now i see none.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to