knex icon indicating copy to clipboard operation
knex copied to clipboard

Bug: ER_PARSE_ERROR for after with comment

Open lichtner opened this issue 10 years ago • 1 comments

May be I found bug. if I use after() with comment() for MYSQL db e.g:

knex.schema.table('Table', function (table) {
    table.integer('col').comment('my comment').after('id');
});

it throws this error:

Error: ER_PARSE_ERROR: 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 'comment 'my comment'' at line 1

if I use only after() or only comment() it works without any problem.

lichtner avatar Jan 29 '15 14:01 lichtner

Seeing the same thing.

Finding this issue was hard since search engines tend to filter the word 'after' and 'comment' is often interpreted as -- a SQL comment and /* more comments */ kind of stuff...

For me this bug was very reproducible. I am simply unable to use Knex' comment() method with MySQL because of it. Still, since it has been open since 2015 I guess I should not hold my breath for a fix 😅

Have you guys ever tried to reproduce this issue? Let me know if you need help on that.

Download avatar Jun 15 '22 10:06 Download