MySQL error in ORDER BY clause in get_artefactchooser_artefacts()

Bug #1416147 reported by Yuliya Bozhko on 2015-01-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Low
Yuliya Bozhko
1.10
Medium
Unassigned
1.9
Medium
Unassigned

Bug Description

For some reason works fine on Postgres...

To reproduce:

1. Create a journal post.
2. Go to pages.
3. Create a page.
4. Add "Journal entry" block.
5. See this error:

Failed to get a recordset: mysqli error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY parent ASC, ctime DESC LIMIT 10' at line 15] in EXECUTE("SELECT a.*, (a.owner IS NOT NULL AND a.owner = '1') AS editable FROM "mhr_artefact" a WHERE ( a.owner = '1' OR a.id IN ( SELECT id FROM "mhr_artefact" WHERE (path = '/5' OR path LIKE '/5/%') AND institution = 'mahara' ) OR a.id IN ( SELECT aar.artefact FROM "mhr_group_member" m JOIN "mhr_artefact" aa ON m.group = aa.group JOIN "mhr_artefact_access_role" aar ON aar.role = m.role AND aar.artefact = aa.id WHERE m.member = '1' AND aar.can_republish = 1 ) OR a.id IN (SELECT artefact FROM "mhr_artefact_access_usr" WHERE usr = '1' AND can_republish = 1) OR a.institution IN ('mahara') ) AND artefacttype IN('blogpost') AND id = 6ORDER BY parent ASC, ctime DESC LIMIT 10") Command was: SELECT a.*, (a.owner IS NOT NULL AND a.owner = ?) AS editable FROM "mhr_artefact" a WHERE ( a.owner = ? OR a.id IN ( SELECT id FROM "mhr_artefact" WHERE (path = ? OR path LIKE ?) AND institution = 'mahara' ) OR a.id IN ( SELECT aar.artefact FROM "mhr_group_member" m JOIN "mhr_artefact" aa ON m.group = aa.group JOIN "mhr_artefact_access_role" aar ON aar.role = m.role AND aar.artefact = aa.id WHERE m.member = ? AND aar.can_republish = 1 ) OR a.id IN (SELECT artefact FROM "mhr_artefact_access_usr" WHERE usr = ? AND can_republish = 1) OR a.institution IN (?) ) AND artefacttype IN(?) AND id = 6ORDER BY parent ASC, ctime DESC and values was (1,1,/5,/5/%,1,1,mahara,blogpost)

SQL is missing space before ORDER BY...

Changed in mahara:
importance: Undecided → Low

Reviewed: https://reviews.mahara.org/4236
Committed: http://gitorious.org/mahara/mahara/commit/9ed9a6326f85c1b0ee0465e5dc52945f2bccd570
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 9ed9a6326f85c1b0ee0465e5dc52945f2bccd570
Author: Yuliya Bozhko <email address hidden>
Date: Fri Jan 30 11:34:58 2015 +1300

SQL error in ORDER BY clause in get_artefactchooser_artefacts (Bug #1416147)

Change-Id: I3b94130c605592ef22e1d5d30f038d3aafe1e03a
Signed-off-by: Yuliya Bozhko <email address hidden>

Robert Lyon (robertl-9) on 2015-01-30
Changed in mahara:
milestone: none → 15.04.0
status: New → Fix Committed
Robert Lyon (robertl-9) on 2015-04-17
Changed in mahara:
status: Fix Committed → Fix Released
Mahara Bot (dev-mahara) wrote :

Patch for "1.9_STABLE" branch: https://reviews.mahara.org/5578

Reviewed: https://reviews.mahara.org/5577
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/fb33d6de34785cf3d0b64445e2298ee37d83d31b
Submitter: Aaron Wells (<email address hidden>)
Branch: 1.10_STABLE

commit fb33d6de34785cf3d0b64445e2298ee37d83d31b
Author: Yuliya Bozhko <email address hidden>
Date: Fri Jan 30 11:34:58 2015 +1300

SQL error in ORDER BY clause in get_artefactchooser_artefacts (Bug #1416147)

Change-Id: I3b94130c605592ef22e1d5d30f038d3aafe1e03a
Signed-off-by: Yuliya Bozhko <email address hidden>
(cherry picked from commit 9ed9a6326f85c1b0ee0465e5dc52945f2bccd570)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/5578
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/142592ddf2ec1a579c4aad10000e6a6d2dfa0379
Submitter: Aaron Wells (<email address hidden>)
Branch: 1.9_STABLE

commit 142592ddf2ec1a579c4aad10000e6a6d2dfa0379
Author: Yuliya Bozhko <email address hidden>
Date: Fri Jan 30 11:34:58 2015 +1300

SQL error in ORDER BY clause in get_artefactchooser_artefacts (Bug #1416147)

Change-Id: I3b94130c605592ef22e1d5d30f038d3aafe1e03a
Signed-off-by: Yuliya Bozhko <email address hidden>
(cherry picked from commit 9ed9a6326f85c1b0ee0465e5dc52945f2bccd570)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers