[Spacewalk-list] Error 500 on snapshots pages
Michael Mraka
michael.mraka at redhat.com
Fri Aug 12 09:41:58 UTC 2011
Pierre Casenove wrote:
...
% There is still a problem in one reformatted queries though:
%
% In file SystemGroup_queries.xml, request "groups_a_system_is_in", a CAST as
% numeric has to be done:
%
% SELECT VSGM.group_id AS ID,
% SG.name AS GROUP_NAME,
% SGT.label AS GROUP_TYPE_LABEL,
% (SELECT 1 FROM rhnUserServerGroupPerms WHERE user_id =
% :user_id AND server_group_id = SG.id) AS USER_PERMITTED_ACCESS
% FROM
% rhnServerGroup SG,
% rhnVisServerGroupMembership VSGM
% LEFT JOIN rhnServerGroupType SGT
% ON CAST(VSGM.group_type as numeric) = SGT.id,
% rhnUserServerGroupPerms USGP
% WHERE VSGM.org_id = :org_id
% AND VSGM.server_id = :sid
% AND VSGM.group_id = SG.id
% AND USGP.user_id = :user_id
% AND USGP.server_group_id = SG.id
% ORDER BY UPPER(SG.name)
%
% I think we're getting close!
Hi Pierre,
I took a look on it and it turned out that 'VSGM.group_type = SGT.id'
condition is completely wrong... Not only it compares varchar vs.
numeric, but also VSGM.group_type is in fact rhnServerGroupType.label
which makes no sense to compare to rhnServerGroupType.id :-/. Moreover
we even don't need to join rhnServerGroupType table here because
rhnServerGroupType.label is already in rhnVisServerGroupMembership view
as group_type... ;)
So the fix is to remove LEFT JOIN completely (see
d64ea81ab324d8d7bd3211093d03267f3dcbbb73). New package
spacewalk-base-1.6.13-1 is on the way.
Regards,
--
Michael Mráka
Satellite Engineering, Red Hat
More information about the Spacewalk-list
mailing list