> Is it not a good practice to preserve case in column name?
I don't really know, I thought the 'most' standard way is to convert
to uppercase.
> automatic Java class generation tools which create Java
> class code according to table definition. They create one member
> variable per column.
Don't they convert camel case to uppercase using _? Example: firstName
> FIRST_NAME. Which tool do you mean?
Regards,
Thomas
> My table DDL is generated, and it always wraps names in double quotes
> to avoid colliding on keywords, e.g. "table_name". Then when writing
> SQL, I just use "SELECT * FROM table_name", and it has worked fine in
> postgres.
The same collisions are possible in CREATE and SELECT. If you quote
identifiers in the CREATE TABLE statement to avoid collisions with
keywords, then you also need to wrap it in any other type of statement
(SELECT, INSERT, DELETE and so on).
I know the list of keywords is different in each database, but I
wouldn't use double quotes because it's simpler. Just avoid keywords.
A list of common keywords is here:
http://ldbc.sourceforge.net/html/grammar.html#keywords, however there
are actually more.
Regards,
Thomas
That sounds nicely pragmatic. I'll think about it.
Thanks,
Stephen
> H2 returns unquoted identifiers in lower case
Only when using the MySQL mode.
> but when h2 console or SquirrelSql then wrap them in quotes cause
> sql exceptions of the forms "table/schema/catalog/column not found".
The newest version of the H2 Console doesn't wrap them in quotes any longer.
If you use SquirrelSQL then I suggest not to use the MySQL mode.
Regards,
Thomas