Does CrateDB allow having upper case or camel case attribute names for object columns? I have a table like this:
create table objecttest(
age integer,
name string,
attrs object
);
Using the insert statement:
insert into objecttest (age,name,attrs) values (30,'harry',{address = '123 street', city = 'city', IPaddress = '10.0.0.1'});
... in crash resulted in:
cr> select * from objecttest;
+-----+---------------------------------------------------------------------+--------+
| age | attrs | name |
+-----+---------------------------------------------------------------------+--------+
| 30 | {"address": "123 street", "city": "city", "ipaddress": "10.0.0.1"} | harry |
+-----+---------------------------------------------------------------------+--------+
SELECT 1 row in set (0.005 sec)
... in CrateDB's JDBC driver resulted in:
cr> select * from objecttest;
+-----+---------------------------------------------------------------------+-------+
| age | attrs | name |
+-----+---------------------------------------------------------------------+-------+
| 30 | {"address": "123 street", "city": "city", "ipaddress": "10.0.0.1"} | harry |
| 30 | {"IPaddress": "10.0.0.1", "address": "123 street", "city": "city"} | harry |
+-----+---------------------------------------------------------------------+-------+
SELECT 2 rows in set (0.004 sec)
IPaddress is now spelled differently. Is this a bug in crate-jdbc?
Without quotes, CrateDB treats all column names as case-insensitive (lower case), hence any column should be quoted in order to retain casing. CrateDB's JDBC driver on the other hand will automatically quote column names, meaning that an insert statement executed there will have the casing as written in the code. Crash/the admin UI/... will use retain casing when issuing:
You will get the same result as if inserted with crate-jdbc.
More on the structure here.
Cheers!