Turn off upper-case for table and column names in HSQL?

人走茶凉 提交于 2019-12-21 04:27:10

问题


How to turn off forced upper-case mode for table and column names in HSQL?

<artifactId>hsqldb</artifactId>
<version>2.3.1</version>

OS: Windows 7 x64


回答1:


The rules around this are explained in the HSQLDB documentation:

When a database object is created with one of the CREATE statements or renamed with the ALTER statement, if the name is enclosed in double quotes, the exact name is used as the case-normal form. But if it is not enclosed in double quotes, the name is converted to uppercase and this uppercase version is stored in the database as the case-normal form.

Case sensitivity rules for identifiers can be described simply as follows:

  • all parts of SQL statements are converted to upper case before processing, except identifiers in double quotes and strings in single quotes
  • identifiers, both unquoted and double quoted, are then treated as case-sensitive
  • most database engines follow the same rule, except, in some respects, MySQL and MS SQLServer.

AFAIK this behaviour can't be turned off. (It's worth noting that standard SQL is case-insensitive when quoted identifiers aren't used.) But as mentioned above, a lower case identifier can be specified by enclosing in quotes, e.g:

CREATE TABLE "lowercasetablename" ("lowercasecolname" INT);
SELECT "lowercasecolname" FROM "lowercasetablename";



回答2:


I am not sure, i understand the problem correctly but just trying to put some effort.

SET DATABASE COLLATION SQL_TEXT_UCC

May be you can refer http://hsqldb.org/doc/guide/dbproperties-chapt.html



来源:https://stackoverflow.com/questions/36196630/turn-off-upper-case-for-table-and-column-names-in-hsql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!