0

CrateDB 是否允许对象列具有大写或驼峰式属性名称?我有一张这样的桌子:

create table objecttest(
 age integer,
 name string,
 attrs object
);

使用插入语句:

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 中的错误吗?

4

1 回答 1

1

如果没有引号,CrateDB 将所有列名视为不区分大小写(小写),因此任何列都应该被引用以保留大小写。另一方面,CrateDB 的 JDBC 驱动程序会自动引用列名,这意味着在那里执行的插入语句将具有代码中编写的大小写。崩溃/管理 UI/... 发出时将使用保留大小写:

insert into objecttest (age,name,attrs) values (30,'harry',{address = '123  street', city = 'city', "IPaddress" = '10.0.0.1'});

您将获得与插入 crate-jdbc 相同的结果。

更多关于这里的结构。

干杯!

于 2016-12-14T11:32:01.140 回答