alter table error #17
-
When I modify a table, I got the following error message thrown by php. In fact I'm testing my laravel app. Maybe planetscale not support alter table? laravel official migration document Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (1,220.75ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (1,367.57ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated: 2019_08_19_000000_create_failed_jobs_table (1,184.82ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated: 2019_12_14_000001_create_personal_access_tokens_table (1,826.26ms)
Migrating: 2021_03_23_152218_create_sessions_table
Illuminate\Database\QueryException
SQLSTATE[HY000]: General error: 1105 unknown error: syntax error at position 61 near 'sessions_id_primary' (SQL: alter table `sessions` add primary key `sessions_id_primary`(`id`)) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Thank you for submitting this issue! The issue seems to be with the syntax, which is acceptable to MySQL but should not be: add primary key `sessions_id_primary`(`id`)) The name of the Having said that, we want to be compatible with MySQL even if it allows something it shouldn't. We're looking into this and will follow up shortly. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
I'm also waiting for your following up because I have a same issue #8151 on Vitess. |
Beta Was this translation helpful? Give feedback.
Thank you for submitting this issue! The issue seems to be with the syntax, which is acceptable to MySQL but should not be:
The name of the
PRIMARY KEY
is always "PRIMARY". The statement you or your php code ran tries to give a different name to the primary key. This shouldn't be allowed, but then again, MySQL does allow it. By the way, the namesessions_id_primary
is completely discarded by MySQL, as you'll be able to see if youSHOW CREATE TABLE sessions
.Having said that, we want to be compatible with MySQL even if it allows something it shouldn't. We're looking into this and will follow up shortly. Thanks again!