Created question in FIWARE Q/A platform on 10-11-2020 at 11:11
Please, ANSWER this question AT https://stackoverflow.com/questions/64767280/fiware-cygnus-postgresql-sink-does-not-create-table-when-entity-id-contains-spec
Question:
Fiware Cygnus PostgreSQL sink does not create table when entity id contains special characters
Description:
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, e.g. urn:ngsi-ld:Motion:001 as recommended in the Fiware tutorials.
I setup a simple stack with Orion, an IoT-Agent as well as Cygnus-NGSI and a PostgreSQL database.
However, PostgreSQL reports the error
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.
Data is then persisted as expected.
Cygnus should replace non-alphanumeric characters inentity ids with _, however, that does not appear to be happening.
Is this just a bug or do I need some sort of name mapping to solve this?