简体   繁体   English

当实体 id 包含特殊字符时,Fiware Cygnus PostgreSQL sink 不会创建表

[英]Fiware Cygnus PostgreSQL sink does not create table when entity id contains special characters

It appears that cygnus-ngsi and its PosgreSQL sink can't create a postgres table when the entity has an id that contains the - chracter, eg urn:ngsi-ld:Motion:001 as recommended in the Fiware tutorials .当实体的 id 包含-字符时cygnus-ngsi及其 PosgreSQL 接收器似乎无法创建 postgres 表,例如urn:ngsi-ld:Motion:001Fiware 教程中推荐的那样

I setup a simple stack with Orion, an IoT-Agent as well as Cygnus-NGSI and a PostgreSQL database.我使用 Orion、物联网代理以及 Cygnus-NGSI 和 PostgreSQL 数据库设置了一个简单的堆栈。

However, PostgreSQL reports the error但是PostgreSQL报错

2020-11-10 08:39:33.404 UTC [66] ERROR: syntax error at or near "-" at character 44
2020-11-10 08:39:33.404 UTC [66] STATEMENT: CREATE TABLE IF NOT EXISTS openiot.urn_ngsi-ld_motion_001_thing (recvTimeTs text,recvTime text,fiwareServicePath text,entityId text,entityType text,attrName text,attrType text,attrValue text,attrMd text)

The error does not occur when a different entity id is used.使用不同的实体 ID 时不会发生该错误。 Data is then persisted as expected.然后数据按预期持久化。

Cygnus should replace non-alphanumeric characters inentity ids with _ , however, that does not appear to be happening. Cygnus 应该用_替换非字母数字字符 inentity id ,但是,这似乎没有发生。 Is this just a bug or do I need some sort of name mapping to solve this?这只是一个错误还是我需要某种名称映射来解决这个问题?

Looking to encoding section in the Postgresql sink documentation it seems no special encoding is done for - .查看Postgresql sink 文档中的 encoding 部分,似乎没有对-进行特殊编码。

Thus, - progresses as it is to Postgresql table creation logic and raises an error, due to it is forbidden in table names by the database.因此, -按照 Postgresql 表创建逻辑的方式进行并引发错误,因为数据库禁止在表名中使用它。

You can explore the name mappings option (although I'm not sure if you can change entity ids using it...).您可以探索名称映射选项(尽管我不确定您是否可以使用它更改实体 ID...)。 Another possible workaround (pretty simple) is not using - in entity ids, eg: urn:ngsild:Motion:001另一种可能的解决方法(非常简单)不在实体 ID 中使用- ,例如: urn:ngsild:Motion:001

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Fiware-Cygnus配置为Postgresql,DynamoDB和CKAN - Fiware-Cygnus configuration to Postgresql, DynamoDB and CKAN Postgresql:返回包含一个或多个指定特殊字符的字符串 - Postgresql : return string that contains one or more of specified special characters 如何基于PostgreSQL和Rails中的表ID列创建特殊的order_number - How to create a special order_number that is based off the table id column in PostgreSQL and Rails 在 postgresql 中搜索特殊字符 - Searching For Special Characters in postgresql 在 postgresql 表中存储带有特殊字符(如引号或反斜杠)的字符串 - Store string with special characters like quotes or backslash in postgresql table PostgreSql 外部表 select 由于特殊字符行而失败 - PostgreSql foreign table select fails due to special characters rows 用花括号括起包含特殊字符的密码不起作用 - Enclosing a password which contains special characters with curly braces does not work 在Postgresql中运行Cygnus的问题 - Problems running Cygnus with Postgresql PostgreSQL何时自动为表创建位图索引? - When does PostgreSQL automatically create a Bitmap index for a table? PostgreSQL和Unicode表名:当信息表包含Unicode字符时,为什么不能从信息模式中选择表名? - Postgresql and unicode table names: Why can I not select the table name from the information schema when it contains unicode characters?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM