Adam Cameron
cf_session_data
table is created as:
CREATE TABLE `cf_session_data` (
`expires` varchar(64) NOT NULL,
`cfid` varchar(64) NOT NULL,
`name` varchar(255) NOT NULL,
`data` longtext NOT NULL,
UNIQUE KEY `ix_cf_session_data` (`cfid`,`name`,`expires`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
And on others:
CREATE TABLE `cf_session_data` (
`expires` varchar(64) NOT NULL,
`cfid` varchar(64) NOT NULL,
`name` varchar(255) NOT NULL,
`data` longtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
All are MySQL 8, Lucee 5.3.9.160. One difference is that the ones that have the KEY are driven by a commandbox docker image, the others are just driven by the standard lucee docker image. I can't think why that would matter though?
I'm not so worried about the charset/collation stuff, but I am concerned about the lack of unique key.
I have found this: https://docs.lucee.org/guides/Various/FAQs/technical-FAQs/database-session.html#tip-manually-check-cf_session_data-table-for, but that alludes to how the table might not be set up properly, rather than why it might not be set up properly.
Other googling only turned up with the same issue; no actual answers.zackster
10/25/2022, 12:02 PMAdam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
ERROR 1142 (42000): ALTER command denied to user
But because that code you pointed to creates a new exception, and doesn't bother to include the previous one, all we end up with is:
Failed to create unique index on cf_session_data;lucee.runtime.exp.DatabaseException: Failed to create unique index on cf_session_data
Which omits the useful stuff.
I think as a rule if you are catching an exception and bubbling another one up, it'd pay to include the original exception in the second one. Or... hey... just don't monkey with the original exception as that's the one that is useful?
Anyway, problem "solved"... thanks for pointing me in the right direction there!
I wonder if there ought to be a rethink around having Lucee create that table? I'm surprised our DSNs can even create the table, let alone the index, which apparently needs further perms still. And I'd've thought in general DSN users would only be able to perform CRUD operations on table data.
At the very least the docs should be tweaked on https://docs.lucee.org/guides/Various/FAQs/technical-FAQs/database-session.html>
I also note it only discusses setting up DSNs in the Admin UI, which would be the exception rather than the rule these days, wouldn't it, when they can be done in Application.cfc?zackster
10/25/2022, 12:50 PMzackster
10/25/2022, 12:53 PMAdam Cameron
Adam Cameron
Adam Cameron
gavinbaumanis
10/26/2022, 10:16 AMFailed to create unique index on cf_session_data;lucee.runtime.exp.DatabaseException: Failed to create unique index on cf_session_data
and that it may be caused by the user that the DSN is using, not having appropriate rights, ensure it has ALTER rights. checked.
----
Also clean up the text just above the example SQL code and ensure that the SQL provided uses LONGTEXT instead of TEXT.zackster
10/26/2022, 10:23 AMMatt Jones
10/28/2022, 1:03 PMzackster
10/28/2022, 1:19 PM