I am trying to alter a postgreSQL table using the following code.
String query = "ALTER TABLE \"georbis:world_boundaries\" DROP COLUMN testcolumn";
sessionFactory.openSession().createSQLQuery(query).executeUpdate();
The problem is my table name contains colon(:) due to which i'm getting the following error.
ERROR: unterminated quoted identifier at or near ""georbis? DROP COLUMN testcolumn" at character 13
STATEMENT: ALTER TABLE "georbis? DROP COLUMN testcolumn
Other answers of similar questions suggest that i should put double quotes(") around the table name which i tried but still getting the same error.
Also when i run the same query from SQL editor it works perfectly fine. I also tried to run the same query for a table that does not contain colon(:) and it worked .
Solution : Thanks everyone. Got the answer from HERE I changed my query like this and it worked.
String query = "ALTER TABLE \"georbis\\:world_boundaries\" DROP COLUMN testcolumn";