How to change a column name in HSQLDB when an existing name is a reserved word?

I am trying to update our database from HSQLDB 1.7 to the latest version. Unfortunately, someone called the column "Default." I cannot rename this column to SQL (this is 1.7, since renaming must happen before the update).

I tried to slip away from the column:

stmt.executeUpdate("ALTER TABLE table_name ALTER COLUMN \"DEFAULT\" RENAME TO new_name");

and various options (including "\" and []), and nothing works, I always return the following

java.sql.SQLException: Column not found: DEFAULT in statement [ALTER TABLE table_name ALTER COLUMN "DEFAULT"]

Am I explicitly missing something?

+4
source share
3 answers

Sorry, someone called the "Default" column

, . "" , , , . .

ALTER TABLE table_name ALTER COLUMN "Default" RENAME TO new_name

... JDBC:

stmt.executeUpdate("ALTER TABLE table_name ALTER COLUMN \"Default\" RENAME TO new_name");
+2

HSQLDB:

, .

:

ALTER TABLE "table_name" ALTER COLUMN "DEFAULT" RENAME TO "new_name"
0

Backtick (`).
.

ALTER TABLE `table_name` ALTER COLUMN `DEFAULT` RENAME TO `new_name`
-1

Source: https://habr.com/ru/post/1585054/


All Articles