"rank" becomes a mysql reserved keyword in version 8 #822

Closed
opened 2026-10-05 00:19:11 +02:00 by adam · 9 comments
Owner

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 ', status
FROM piwigo_categories
WHERE id_uppercat IS NULL
ORDER BY rank AS' at line 1

SELECT id, name, permalink, dir, rank, status
FROM piwigo_categories
WHERE id_uppercat IS NULL
ORDER BY rank ASC
; in D:\www_root\piwigo-2.9.4\include\dblayer\functions_mysqli.inc.php on line 845

piwigo version: 2.9.4
mysql version: 8.0.11

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 ', status FROM piwigo_categories WHERE id_uppercat IS NULL ORDER BY rank AS' at line 1 SELECT id, name, permalink, dir, **rank**, status FROM piwigo_categories WHERE id_uppercat IS NULL ORDER BY rank ASC ; in D:\www_root\piwigo-2.9.4\include\dblayer\functions_mysqli.inc.php on line 845 **piwigo version: 2.9.4** **mysql version: 8.0.11** <!-- github-sync-id:354007605 -->
adam closed this issue 2026-10-05 00:19:11 +02:00
Author
Owner

rank is a reserved word as of MySQL 8.0.

I've attempted to find all the places using rank and added backticks: #922

There's also the album 'Manual sort order' that gets saved as "rank ASC" and then I think appended to an SQL query when it's loaded. I might be wrong about that though.

`rank` is a reserved word as of MySQL 8.0. I've attempted to find all the places using `rank` and added backticks: #922 There's also the album 'Manual sort order' that gets saved as "rank ASC" and then I think appended to an SQL query when it's loaded. I might be wrong about that though. <!-- github-comment-id:417196571 -->
Author
Owner

There are also column named "name" and "status" which are reserved words:

SELECT id, name, permalink, dir, rank, status
FROM piwigo_categories
WHERE id_uppercat IS NULL
ORDER BY rank

There are also column named "name" and "status" which are reserved words: SELECT id, name, permalink, dir, rank, status FROM piwigo_categories WHERE id_uppercat IS NULL ORDER BY rank <!-- github-comment-id:418552783 -->
Author
Owner

@UnConundrum are you getting errors with them? With MySQL 8.0 as well?

I guess best practice would be to quote every column name.

@UnConundrum are you getting errors with them? With MySQL 8.0 as well? I guess best practice would be to quote every column name. <!-- github-comment-id:418560237 -->
Author
Owner

Yes, I am.

I guess it’s unrelated, but I’m also getting a JSON error.

On Sep 4, 2018, at 8:30 PM, Sam Wilson notifications@github.com wrote:

@UnConundrum https://github.com/UnConundrum are you getting errors with them? With MySQL 8.0 as well?

I guess best practice would be to quote every column name.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/Piwigo/Piwigo/issues/919#issuecomment-418560237, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwKoIuJ8aGyF06yKVyg0Q3dv0RNsfLrks5uXxsRgaJpZM4WMXHp.

Yes, I am. I guess it’s unrelated, but I’m also getting a JSON error. > On Sep 4, 2018, at 8:30 PM, Sam Wilson <notifications@github.com> wrote: > > @UnConundrum <https://github.com/UnConundrum> are you getting errors with them? With MySQL 8.0 as well? > > I guess best practice would be to quote every column name. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub <https://github.com/Piwigo/Piwigo/issues/919#issuecomment-418560237>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAwKoIuJ8aGyF06yKVyg0Q3dv0RNsfLrks5uXxsRgaJpZM4WMXHp>. > <!-- github-comment-id:418568134 -->
Author
Owner

Any chance this will be worked on in the near future?

Any chance this will be worked on in the near future? <!-- github-comment-id:423294004 -->
Author
Owner

I'm not sure.

@plegall might know.

I'm not sure. @plegall might know. <!-- github-comment-id:423386701 -->
Author
Owner

There are also column named "name" and "status" which are reserved words:

Add 'section' to it.

> There are also column named "name" and "status" which are reserved words: > Add 'section' to it. <!-- github-comment-id:442258478 -->
Author
Owner

I gave a general reply about the "reserved keywords in MySQL 8" on https://github.com/Piwigo/Piwigo/issues/996#issuecomment-479804890

I gave a general reply about the "reserved keywords in MySQL 8" on https://github.com/Piwigo/Piwigo/issues/996#issuecomment-479804890 <!-- github-comment-id:479807598 -->
Author
Owner

Error on admin user page with mysql 8 https://github.com/Piwigo/Piwigo/issues/1095

Error on admin user page with mysql 8 https://github.com/Piwigo/Piwigo/issues/1095 <!-- github-comment-id:541409383 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#822