CrateDB是否允许对象列具有大写或驼峰大小写的属性名称?我有一张这样的桌子:
create table objecttest(
age integer,
name string,
attrs object
);
使用insert语句:
insert into objecttest (age,name,attrs) values (30,'harry',{address = '123 street', city = 'city', IPaddress = '10.0.0.1'});
......在崩溃中导致:
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)
...在CrateDB的JDBC驱动程序中导致:
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现在拼写不同。这是crate-jdbc中的错误吗?
答案 0 :(得分:1)
如果没有引号,CrateDB会将所有列名称视为不区分大小写(小写),因此应引用任何列以保留大小写。另一方面,CrateDB的JDBC驱动程序将自动引用列名,这意味着在那里执行的insert语句将具有代码中编写的大小写。崩溃/管理员UI / ...将在发出时使用保留套管:
insert into objecttest (age,name,attrs) values (30,'harry',{address = '123 street', city = 'city', "IPaddress" = '10.0.0.1'});
您将获得与使用crate-jdbc插入时相同的结果。
有关结构here的更多信息。
干杯!