Skip to main content
14-Alexandrite
August 15, 2022
Solved

Moving data from stream to postgres with an infinity value

  • August 15, 2022
  • 2 replies
  • 1010 views

I am migrating streams to postgres and I have some columns which contain infinity values. I changed the schema in postgres to double precision, which does allow inifinity values. However, I get the error "JSON does not allow non-finite numbers." when I try to move my stream into here and it has an infinity value. How do I migrate a stream with inifinity for some values into postgres?

Best answer by nmilleson

@JO_9930585 ,

 

This is a case where you'll need to use the <<>> brackets around your SQL command inputs instead of the [[ ]] square brackets.  Ex:

insert into myTable (uid, value1, value2) VALUES
([[uid]], <<numberValue1>>, <<numberValue2>>)

 

numberValue1 and numberValue2 should then be STRING inputs.  Now you'll be able to use the "Infinity" keyword that works with the postgresql database.

 

-Nick

2 replies

24-Ruby III
August 16, 2022

 Hi,

 

There was a similar question before - "JSON does not allow non-finite numbers for infotable creation": https://community.ptc.com/t5/ThingWorx-Developers/JSON-does-not-allow-non-finite-numbers-for-infotable-creation/td-p/760542 

nmilleson17-PeridotAnswer
17-Peridot
August 16, 2022

@JO_9930585 ,

 

This is a case where you'll need to use the <<>> brackets around your SQL command inputs instead of the [[ ]] square brackets.  Ex:

insert into myTable (uid, value1, value2) VALUES
([[uid]], <<numberValue1>>, <<numberValue2>>)

 

numberValue1 and numberValue2 should then be STRING inputs.  Now you'll be able to use the "Infinity" keyword that works with the postgresql database.

 

-Nick