Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin is a reserved word in mySQL 8 #93

Closed
fiedsch opened this issue Jun 28, 2018 · 4 comments
Closed

admin is a reserved word in mySQL 8 #93

fiedsch opened this issue Jun 28, 2018 · 4 comments
Assignees
Labels
Milestone

Comments

@fiedsch
Copy link

fiedsch commented Jun 28, 2018

When using contao/install I'm asked to create a admin user though there already exists a user with admin = '1' in the database.

When trying to create a (new) admin user an exception is thrown.

Reason:

  • admin is a reserved word in 8.x versions of mySQL (see https://dev.mysql.com/doc/refman/8.0/en/keywords.html which states : "ADMIN became nonreserved in 8.0.12" but 8.0.12 is not yet released.

  • The error occures in hasAdminUser() where using `admin` = '1' would solve the issue.

  • same problem in persistAdminUser()

I don't know if changes within Contao are required. Especially as admin will no longer be a reserved word from mySQL 8.0.12 on. So this is mostly to file the issue so it could by found if somebody else stumbles upon the same problem.

@leofeyer leofeyer added the defect label Jul 2, 2018
@leofeyer leofeyer added this to the 4.4.21 milestone Jul 2, 2018
@leofeyer
Copy link
Member

$statement = $this->connection->prepare("
INSERT INTO
tl_user
(
tstamp,
name,
email,
username,
password,
language,
backendTheme,
admin,
showHelp,
useRTE,
useCE,
thumbnails,
dateAdded
)
VALUES
(:time, :name, :email, :username, :password, :language, 'flexible', 1, 1, 1, 1, 1, :time)
");

@ausi Do I quote only admin or all field names?

@ausi
Copy link
Member

ausi commented Jul 11, 2018

AFAIR we agreed on only quoting reserved field names in hardcoded queries.

@leofeyer
Copy link
Member

Ok. Looks crappy though. 😄

@leofeyer leofeyer self-assigned this Jul 12, 2018
leofeyer added a commit to contao/core-bundle that referenced this issue Jul 12, 2018
@leofeyer
Copy link
Member

Fixed in 86f04c1 and contao/core-bundle@4b2f9d2.

@leofeyer leofeyer modified the milestones: 4.4.21, 4.4 May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants