-
Notifications
You must be signed in to change notification settings - Fork 177
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
PR CONTRIB-6515 - Fixed bug with CSV export #73
Conversation
Thanks for the new request. I'm sorry that this issue is taking so long, but I am struggling to understand the problem still. In the current select statement, the raw SQL would look like this:
Does that statement work in Oracle? |
Yes, that statement works in Oracle. The kind of thing that does not work is [WHERE text_column = varchar_column] or [ORDER BY text_column]. |
Thanks Tim. Then I don't see how the proposed code change can fix the problem? It is adding the "sql_order_by_text" function to the field select portion of the SQL. And the "qro.response" field is not used in any comparison nor order statement. What am I not understanding? |
Could the problem be caused by different types returned in the "response" column? For the sql, the response column can contain:
Maybe we need to have a "cast" on all "response" returns to ensure that they are all the same? On other words, something similar to what Dan proposed earlier:
|
Right, like with =, you can't mix these types in a UNION or similar. |
Okay. I now understand the need for this. Because we longtext and varchars being returned as UNIONS in the same field, Oracle needs to cast them to the same type. |
@mchurchward Tested new version of the code with Oracle. We confirm everything is working perfectly!! :-) Thanks! :-) |
Our databases are Oracle and we've detected this bug in some cases (with MySQL is working properly). We've tried to find a generic solution (in Oracle, converting TO_CHAR the qrX.response field is also working).
Tested in Moodle 3.1.2 Oracle databases.
This is an improving patch for the PR, which uses sql_order_by_text function instead of sql_compare_text: #68
For some DB, like Oracle, it's necessary to specify "The number of chars to use for this field" (for instance 1000), because CLOB fields don't support direct returning of such fields.