Announcement

#1 2023-05-21 15:23:56

judecooks
Member
2014-08-16
10

ORDER BY error

Hi all,

Now getting this error on Piwigo.  Seems very similar to [Github] Piwigo issue #376 so I posted on that issue too.  I can't test the workaround listed in github since I am on shared hosting.


Error message:
Warning: [mysql 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 'ASC, id ASC' at line 7

SELECT DISTINCT(image_id)
FROM piwigo_image_category
INNER JOIN piwigo_images ON id = image_id
WHERE
category_id = 1926

ORDER BY date_creation ASC, rank ASC, id ASC
; in /home/.../include/dblayer/functions_mysqli.inc.php on line 847

Piwigo 13.7.0
Installed on 10 March 2019, 4 years 2 months 1 week 2 days ago
Operating system: Linux
PHP: 7.4.30
MySQL: 8.0.28-0ubuntu0.20.04.3 [2023-05-20 07:07:42]
Graphics Library: External ImageMagick 6.9.7-4

Offline

 

#2 2023-05-22 01:26:44

erAck
Only trying to help
2015-09-06
2026

Re: ORDER BY error

Your problem seems unrelated to the issue you mentioned. It looks like the "rank is now a MySQL keyword" problem discussed a dozen times in this forum.
See [Forum, post 184912 by erAck in topic 32379] Mysql error 1064 after 13.2.0 update.

If that helps you should clarify your comment in the GitHub issue.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2023-05-22 02:23:34

judecooks
Member
2014-08-16
10

Re: ORDER BY error

Thank you - I did in fact Search the forum but didn't find that entry.  While I appreciate your reply, further courtesy towards newer users would be appreciated.

The fix does appear to work, but having to reset sort order on all albums manually feels like a bug/regression on the latest version -- what is driving the error and is there a code correction that could be done to fix?

Offline

 

#4 2023-05-22 10:25:36

erAck
Only trying to help
2015-09-06
2026

Re: ORDER BY error

It affects only users of previous versions that did not escape the rank word when storing the sort order in the database. The current version does it correctly, hence switching sort order back and forth helps.

Update code could check the piwigo_categories table's image_order column for unescaped rank words and correct them but apparently doesn't.


Running Piwigo at https://erack.net/gallery/

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact