Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error inserting in lastdata: (ERROR: function to_timestamp(timestamp with time zone, unknown) does not exist #2087

Closed
AlvaroVega opened this issue Sep 28, 2021 · 2 comments

Comments

@AlvaroVega
Copy link
Member

(ERROR: function to_timestamp(timestamp with time zone, unknown) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.

with a SQL like:
INSERT INTO alcobendas.lighting_streetlight_lastdata (recvTime,fiwareServicePath,entityId,entityType,refStreetlightGroup,refStreetlightGroup_md,image,image_md,refStreetlightControlCabinet,refStreetlightControlCabinet_md,address,address_md,serialNumber,serialNumber_md,workingMode,workingMode_md,manufacturerName,manufacturerName_md,dateLastSwitchingOn,dateLastSwitchingOn_md,illuminanceLevel,illuminanceLevel_md,municipality,municipality_md,dateServiceStarted,dateServiceStarted_md,dateLastSwitchingOff,dateLastSwitchingOff_md,dateMeteringStarted,dateMeteringStarted_md,timer,timer_md,delay,delay_md,powerState,powerState_md,controllingMethod,controllingMethod_md,luminosity,luminosity_md,location,location_md,refStreetlightControlContactor,refStreetlightControlContactor_md,TimeInstant,TimeInstant_md,activePower,activePower_md,status,status_md) VALUES ('2021-09-27 14:56:02.36','/alumbrado','ENT-LUM-002','Streetlight','ENT-GRU-001','[]','https://iluminashop.com/wp-content/uploads/2019/06/Farola-led-diamond-smd-pro-100w.jpg','[]','ENT-CUA-001','[]','Street2','[]','OP00096F160318C000002','[]','automatic','[]','Telefonica','[]','2021-09-08T19:00:00.160Z','[]',0,'[]','NA','[]','2020-02-11T04:34:00.000Z','[]','2021-09-09T07:00:00.174Z','[]','2020-02-11T04:34:00.000Z','[]',0,'[]',0,'[]','off','[]','group','[]',11304.865266292,'[]',ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-3.636261,40.538454]}'),'[]','ENT-CONT-001','[]','2021-09-27T14:45:00.006Z','[]',0,'[]','nok','[]') ON CONFLICT (entityid) DO UPDATE SET recvTime=EXCLUDED.recvTime, fiwareServicePath=EXCLUDED.fiwareServicePath, entityId=EXCLUDED.entityId, entityType=EXCLUDED.entityType, refStreetlightGroup=EXCLUDED.refStreetlightGroup, refStreetlightGroup_md=EXCLUDED.refStreetlightGroup_md, image=EXCLUDED.image, image_md=EXCLUDED.image_md, refStreetlightControlCabinet=EXCLUDED.refStreetlightControlCabinet, refStreetlightControlCabinet_md=EXCLUDED.refStreetlightControlCabinet_md, address=EXCLUDED.address, address_md=EXCLUDED.address_md, serialNumber=EXCLUDED.serialNumber, serialNumber_md=EXCLUDED.serialNumber_md, workingMode=EXCLUDED.workingMode, workingMode_md=EXCLUDED.workingMode_md, manufacturerName=EXCLUDED.manufacturerName, manufacturerName_md=EXCLUDED.manufacturerName_md, dateLastSwitchingOn=EXCLUDED.dateLastSwitchingOn, dateLastSwitchingOn_md=EXCLUDED.dateLastSwitchingOn_md, illuminanceLevel=EXCLUDED.illuminanceLevel, illuminanceLevel_md=EXCLUDED.illuminanceLevel_md, municipality=EXCLUDED.municipality, municipality_md=EXCLUDED.municipality_md, dateServiceStarted=EXCLUDED.dateServiceStarted, dateServiceStarted_md=EXCLUDED.dateServiceStarted_md, dateLastSwitchingOff=EXCLUDED.dateLastSwitchingOff, dateLastSwitchingOff_md=EXCLUDED.dateLastSwitchingOff_md, dateMeteringStarted=EXCLUDED.dateMeteringStarted, dateMeteringStarted_md=EXCLUDED.dateMeteringStarted_md, timer=EXCLUDED.timer, timer_md=EXCLUDED.timer_md, delay=EXCLUDED.delay, delay_md=EXCLUDED.delay_md, powerState=EXCLUDED.powerState, powerState_md=EXCLUDED.powerState_md, controllingMethod=EXCLUDED.controllingMethod, controllingMethod_md=EXCLUDED.controllingMethod_md, luminosity=EXCLUDED.luminosity, luminosity_md=EXCLUDED.luminosity_md, location=EXCLUDED.location, location_md=EXCLUDED.location_md, refStreetlightControlContactor=EXCLUDED.refStreetlightControlContactor, refStreetlightControlContactor_md=EXCLUDED.refStreetlightControlContactor_md, TimeInstant=EXCLUDED.TimeInstant, TimeInstant_md=EXCLUDED.TimeInstant_md, activePower=EXCLUDED.activePower, activePower_md=EXCLUDED.activePower_md, status=EXCLUDED.status, status_md=EXCLUDED.status_md WHERE alcobendas.lighting_streetlight_lastdata.entityid=EXCLUDED.entityid AND to_timestamp(alcobendas.lighting_streetlight_lastdata.recvtime, 'YYYY-MM-DD HH24:MI:SS.MS') < to_timestamp(EXCLUDED.recvtime, 'YYYY-MM-DD HH24:MI:SS.MS')

@AlvaroVega
Copy link
Member Author

ti works when:

to_timestamp(alcobendas.lighting_streetlight_lastdata.recvtime::text, 'YYYY-MM-DD HH24:MI:SS.MS') < to_timestamp(EXCLUDED.recvtime, 'YYYY-MM-DD HH24:MI:SS.MS')

so current functionality is expecting a string timestamp

@fgalan
Copy link
Member

fgalan commented Sep 28, 2021

Fixed by PR #2090

@fgalan fgalan closed this as completed Sep 28, 2021
@fgalan fgalan added this to the release/2.14.0 milestone Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants