CSVREAD creates uppercased column names for single word names

52 views
Skip to first unread message

George Ivanov

unread,
Sep 12, 2019, 10:53:38 AM9/12/19
to H2 Database
If you use CSVREAD function for the following CSV source:


"Col_A","Col B"

valA,valB


H2 will create the following table:

Col_A gets uppercased.png

Why would "Col_A" become "COL_A"?

Is that a bug?

Evgenij Ryazanov

unread,
Sep 12, 2019, 11:34:03 AM9/12/19
to H2 Database
No, it's not a bug.

Such behavior is documented, but in obscure way:
https://h2database.com/html/functions.html#csvread

Use caseSensitiveColumnNames option if you want to preserve case of column names unconditionally.
CSVREAD('filename.csv', NULL, 'caseSensitiveColumnNames=false')

George Ivanov

unread,
Sep 12, 2019, 11:41:03 AM9/12/19
to H2 Database
Thank you!

Evgenij Ryazanov

unread,
Sep 12, 2019, 11:49:42 AM9/12/19
to H2 Database
I meant caseSensitiveColumnNames=true, of course.

George Ivanov

unread,
Sep 13, 2019, 4:28:30 PM9/13/19
to H2 Database
sure! should one use caseSensitiveColumnNames anywhere else too?

On Thursday, September 12, 2019 at 6:49:42 PM UTC+3, Evgenij Ryazanov wrote:
I meant caseSensitiveColumnNames=true, of course.

Evgenij Ryazanov

unread,
Sep 13, 2019, 8:56:19 PM9/13/19
to H2 Database
On Saturday, 14 September 2019 04:28:30 UTC+8, George Ivanov wrote:
sure! should one use caseSensitiveColumnNames anywhere else too?
I'm not sure what do you mean, but if you use quoted names of columns ("ColumnName") in your SQL commands, they are case sensitive by default. 

George Ivanov

unread,
Sep 14, 2019, 6:19:14 AM9/14/19
to H2 Database
Thank you!
Reply all
Reply to author
Forward
0 new messages