forked from telefonicaid/fiware-orion
-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
Description
Looking at the source code this morning I found out that if a Relationship is not a simple string, it will not be stored in Postgres!
pgAttributeAppend.cpp:
else if (strcmp(type, "Relationship") == 0)
{
if (valueNodeP->type == KjString)
{
snprintf(buf, bufSize, "%s('%s', '%s', '%s', '%s', %s, %s, %s, '%s', 'Relationship', '%s', null, null, null, null, null, null, null, null, null, null, '%s')",
comma, instanceId, attributeName, opMode, entityId, observedAt, hasSubProperties, unitCode, datasetId, valueNodeP->value.s, orionldState.requestTimeString);
}
#if 0
else
{
//
// FIXME: Right now, we can't enter here. See 'skip' variable in pgAttributeBuild()
//
// WARNING: If an attribute is HUGE, it may not have room enough in a buffer allocated by kaAlloc (there's a max-size)
int renderedValueSize = kjFastRenderSize(valueNodeP);
char* renderedValue = kaAlloc(&orionldState.kalloc, renderedValueSize);
kjFastRender(valueNodeP, renderedValue);
snprintf(buf, bufSize, "%s('%s', '%s', '%s', '%s', %s, %s, %s, '%s', 'RelationshipArray', null, null, null, null, '%s', null, null, null, null, null, null, '%s')",
comma, instanceId, attributeName, opMode, entityId, observedAt, hasSubProperties, unitCode, datasetId, renderedValue, orionldState.requestTimeString);
}
#endif
See that @if 0?
Well, this needs to be fixed.
Apparently nobody is using TRoE and Relationships as arrays.
Easy fix, but, needs to be done.