2

I installed Squirel SQL on Ubuntu and a downloaded and put a MySQL driver into the lib folder of the Squirel folder. Then I chose this driver in the "extra class" tab when configuring Squirel MySQL driver. Connecting to the database and viewing data works but when I try to rename a column in Squirel it suggests Oracle-specific code to do it instead of a MySQL-specific variant. What did I do wrong? Doesn't Squirel's refactoring tools support MySQL or how do I configure it to properly rename columns? PhpMyAdmin automaticaly solves the task just fine.

This is the SQL that is shown when I click "show SQL" in the "modify column" menu:

ALTER TABLE some_column ALTER COLUMN "one_name" RENAME TO "another_name";

This doesn't work. mySQL answers with incorrect syntax error.

Exact order of clicks to reproduce is: right-click on a table in the left panel, then in the context menu "refactoring"->"column"->"modify column". Then you choose the column and edit the name. Button "execute" leads to an incorrect syntax error and "show sql" gives me this sql.

4
  • OK. Turn on the general log and show us, exactly, the SQL code shown when you try and perform the operation. SQL Squirrel is normally a top-notch tool, and I'd be very surprised if it messed up so seriously on mainstream database servers like MySQL.
    – Vérace
    Commented Apr 7, 2015 at 19:41
  • @Vérace, I edited the question and added the exact code it suggests.
    – Gherman
    Commented Apr 8, 2015 at 6:45
  • I've used SQuirreL SQL before but haven't for a while. So I downloaded and installed it, but I can't find the "modify column menu" - could you put up a screenshot of what you are doing?
    – Vérace
    Commented Apr 8, 2015 at 12:49
  • @Vérace, I added exact order of actions to the end of the question.
    – Gherman
    Commented Apr 8, 2015 at 14:05

2 Answers 2

1

Works for me with the latest version of SQuirreL. Make sure that you change the dialect to MySQL in the Alter Column dialog. Its just below the column name.

3
  • Woops, that's weird two people couldn't find it. I have to reaccept the answer. Too bad it won't remember the dialect and I have to always choose it.
    – Gherman
    Commented Apr 9, 2015 at 6:22
  • Its probably worth a feature request to SQuirreL asking for it to default to the dialect for the current connection.
    – Colin Bell
    Commented Apr 9, 2015 at 6:37
  • Well spotted that man! I would still suggest though that it's a bug in SQuirreL SQL since it should (IMHO) recognise that you're using MySQL since your Driver and Alias have to be for a MySQL database. +1. Sorry for misleading you @German
    – Vérace
    Commented Apr 9, 2015 at 19:47
2

OK - the syntax for changing a column name in MySQL is

ALTER TABLE table_name CHANGE old_col_name new_col_name COL_DATA_TYPE;

However, it appears that the syntax generated by SQuirreL SQL is

ALTER TABLE table_name ALTER COLUMN "old_col_name" RENAME TO "new_col_name";

I tried this with both the MySQL jdbc driver (from mysql.com) and the MariaDB driver (from mariadb.org) and it fails on both counts.

Indeed using the MySQL contextual menu (just above the Refactoring one you tried to use), it is also impossible to modify the column name.

So, indeed, it appears that you have discovered a bug in SQuirreL SQL. Congratulations!

You can, of course, use the SQL window to perform this operation (tested).

All I can say is that I'm surprised that SQuirreL SQL has such a flaw for a server as popular as MySQL.

2
  • Well, thanks for your help. I suppose I should go report it to SQuirreL SQL developers now.
    – Gherman
    Commented Apr 8, 2015 at 15:04
  • And a +1 to you for making that effort! :-)
    – Vérace
    Commented Apr 8, 2015 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.