SQL "Alter" not working

Issue #343 resolved
Former user created an issue


When trying to add a column with ALTER in the SQL tab the command which works well when used directly with the SQLite CLI tool, is not working. For example if I do ALTER TABLE albums ADD COLUMN test Integer on a table, output is just: ALTER TABLE albums ADD COLUMN test Integer ERROR:

Comments (8)

  1. phpLiteAdmin repo owner


    The following Syntax works:

    ALTER TABLE "albums" ADD 'test' Integer 

    phpLiteAdmin currently is a little picky about the syntax of ALTER TABLE commands. This is because it does not simply pass them to SQLite, but parses them and creates workaround commands for ALTER TABLE commands that SQLite does not understand. For example, you can also execute ALTER TABLE "testALTER" DROP "test" in phpLiteAdmin, even though SQLite does not support DROP.

    But I agree that

    • ADD COLUMN should be supported, not only ADD
    • We should consider being less picky with the quoting or at least give better error messages.
  2. Log in to comment