Commit 9e7e92e
committed
Fix a potentially ambiguous column in SQL order by clauses.
In `WeBWorK::ContentGenerator::Instructor::UserDetail` and
`WeBWorK::ContentGenerator::Instructor::ProblemSet` I used
`q{(SUBSTRING(set_id,INSTR(set_id,',v')+2)+0)}` for the order by clause
in `getMergedSetVersionsWhere` calls. The problem is that
`getMergedSetVersionsWhere` performs an inner join on the row from the
`user_set` table that is the user's versioned set, the row from that
same table that is the user's template set, and the global template set
from the `set` tabel. Apparently some database configurations are
lenient and assume the first table, but others do not.
So this replaces that with
`grok_versionID_from_vsetID_sql($db->{set_version_merged}->sql->_quote('set_id'))`.
The `_quote` call ensures that the `set_id` column is selected from the
primary table (the row that is the user's versioned set) since it is
passed through the `transform_all` method of
`WeBWorK::DB::Schema::NewSQL::Merge`.
This will most likely fix #2341. Although I am can't (easily) test this,
and can't reproduce the issue reported there. I suspect that this
occurs when `mysql` is used instead of `MariaDB`. I suspect that
`MariaDB` is more lenient on this.1 parent 0d9f5e2 commit 9e7e92e
2 files changed
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
161 | | - | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
198 | | - | |
199 | | - | |
200 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
| |||
0 commit comments