[Bug report] PostgreSQL ALTER TABLE syntax is wrong

rasmush's profile image rasmush posted 8 years ago in Feature discussion Permalink

Hi,

Just wanted to re-flag the issue that was also brought up in an old thread (http://www.heidisql.com/forum.php?t=19839). The ALTER TABLE HeidiSQL uses with PostgreSQL is wrong and throws errors.

The original example was the following code which is generated by HeidiSQL

ALTER TABLE "downloadlog"
    ALTER COLUMN  "downloadtime" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;

But accoriding to the PostgreSQL documentation (http://www.postgresql.org/docs/current/static/sql-altertable.html) this should instead be formatted the following way:

ALTER TABLE "downloadlog"
    ALTER COLUMN "downloadtime" TYPE TIMESTAMP,
    ALTER COLUMN "downloadtime" SET NOT NULL,
    ALTER COLUMN "downloadtime" SET DEFAULT CURRENT_TIMESTAMP;

It should be a relatively easy fix that would mean that you could actually use HeidiSQL for working with PostgreSQL other than simple SELECT queries.

Best regards, Rasmus

Please login to leave a reply, or register at first.