Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM FindProjects, orderBy "project" column fails with invalid sql #37

Open
eigood opened this issue Feb 3, 2022 · 1 comment
Open

PM FindProjects, orderBy "project" column fails with invalid sql #37

eigood opened this issue Feb 3, 2022 · 1 comment

Comments

@eigood
Copy link

eigood commented Feb 3, 2022

qapps/hm/Project/FindProject, shows all projects for me. Good. I then click "Project Up or Down" error. That gives a parameter orderByField=^workEffortId. The '^' gets converted to UPPER(workEffortId) in the generated sql. However, component/HiveMind/screen/HiveMindRoot/Project/FindProject.xml, the actions/WorkEffortParty has distinct=true, and that conflicts, as I get this postgresql error: Caused by: org.postgresql.util.PSQLException: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

The generated SQL looks like this:

SELECT DISTINCT WEFF.WORK_EFFORT_ID, WEFF.WORK_EFFORT_NAME, WEFF.PRIORITY, WEFF.STATUS_ID, WEFF.ESTIMATED_COMPLETION_DATE, WEFF.ESTIMATED_WORK_TIME, WEFF.ACTUAL_WORK_TIME FROM (public.WORK_EFFORT WEFF LEFT OUTER JOIN public.WORK_EFFORT_PARTY WEP ON WEFF.WORK_EFFORT_ID = WEP.WORK_EFFORT_ID) WHERE (WEFF.WORK_EFFORT_TYPE_ENUM_ID = $1 AND (WEFF.VISIBILITY_ENUM_ID IN ($2, $3) OR (((WEP.FROM_DATE IS NULL OR WEP.FROM_DATE <= $4) AND (WEP.THRU_DATE IS NULL OR WEP.THRU_DATE > $5)) AND WEP.PARTY_ID = $6))) ORDER BY WEFF.WORK_EFFORT_ID ASC NULLS LAST, UPPER(WEFF.WORK_EFFORT_ID) DESC NULLS LAST OFFSET 0 ROWS FETCH FIRST 20 ROWS ONLY

Note the doubled-up order by entries.

This is further conflicted by the show-order-by=case-insenstive in that same xml file.

I'm not sure where to go about fixing this, but it super easy to replicate.

@eigood
Copy link
Author

eigood commented Feb 4, 2022

Wanting to sort those columns with case insensitivity makes sense, and I don't want to disable that feature. But then I'm not certain why that screen has set distinct=true, so I want to leave that as well. This seems to be a bug in the framework code, and at a guess, if a column has been marked as insenstive-case, the orderBy processing logic should check to see if the field is already in the orderby list, and adjust it in-place to be UPPER().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant