Variable is truncated after 1000 size

simple loop
var sql_query = "DELETE from spot.clients WHERE clients_id IN (";
for (i=0;i<to_delete.length;i++){
if (i > 0) sql_query += ",";
sql_query += to_delete[i];
sql_query += ")";
msg.payload = sql_query;

output gets truncated, while playing with fixed value for max loop, I noticed that while the string (sql_query) is below 1000 chars it is not truncated.

Above that the string is truncated producing a SQL error

If you mean it is truncated in the Debug sidebar, then yes, the Debug sidebar truncates the values it displays at 1000 characters. This prevents the debug sidebar/editor from being swamped with very large amounts of data.

The actual value of msg.payload will not be truncated. You can verify that by enabling the Debug node option to log to the system console as well - that output does not get truncated.

I understand that, but I get the error in the postgres node...makes sense?

Without any details of what error you are getting, or from where, it is very hard to say.

My suggestion about the Debug node was a guess based on the 1000 character limit you mentioned - as that is a known and expected behaviour of the Debug node.

If another node is giving an error, you need to tell us what the error actually is.

You are right, the console outputs the whole string, thanks!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.