# How to send string node to a table in Postgres

**URL:** <https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678>\
**Category:** General\
**Tags:** node-red-dashboard, database, function-node, mqtt\
**Created:** [18 April 2023 04:14 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678 "2023-04-18T04:14:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![daaven](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@daaven](https://discourse.nodered.org/u/daaven)\
**Post date:** [18 April 2023 04:14 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678/1 "2023-04-18T04:14:26Z")

</div>

![Screenshot (25)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/e/be82d97fff7d1d5bcbce0ade1ec672f3daf0e6aa.png)  
 ![Screenshot (26)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/1/71dd10b681751da7a943ef1311ccea976380c7a0.png)

The two MQTT nodes, Customer Name & Description, are ASCII code that are 'split' then changed to string characters. I want to send those strings to a table in my database using postgres. I figured out how to send all integer values (analog, test time, serial number, and job number) but I can't seem to figure out how to send the two MQTT that use string value.  
The code I use on my function node is above (I forgot to add description on it). Every time I run the code it tells me 'customer name is invalid format'

---

<div class="post-metadata">

**Author:** ![Bean](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bean/32/78987_2.png) [@Bean](https://discourse.nodered.org/u/Bean)\
**Post date:** [18 April 2023 06:48 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678/2 "2023-04-18T06:48:38Z")

</div>

if the database is giving you that error then you need to check the data type of the column

---

<div class="post-metadata">

**Author:** ![daaven](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@daaven](https://discourse.nodered.org/u/daaven)\
**Post date:** [18 April 2023 17:58 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678/3 "2023-04-18T17:58:51Z")

</div>

The column uses data type "text" which should accept string values

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [18 April 2023 19:21 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678/4 "2023-04-18T19:21:19Z")

</div>

Is` msg.customername` actually a string value all the time?

---

<div class="post-metadata">

**Author:** ![daaven](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@daaven](https://discourse.nodered.org/u/daaven)\
**Post date:** [19 April 2023 15:07 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678/5 "2023-04-19T15:07:22Z")

</div>

What do you mean all the time? It should always be a string value

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 April 2023 15:54 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678/6 "2023-04-19T15:54:16Z")

</div>

Feed the message going into the postgres node into a debug node and show us what is there.

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [19 April 2023 19:06 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678/7 "2023-04-19T19:06:56Z")

</div>

> [@daaven](#):
>
> What do you mean all the time? It should always be a string value

Correct, but the error message indicates that this is not the case

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 June 2023 19:07 UTC](https://discourse.nodered.org/t/how-to-send-string-node-to-a-table-in-postgres/77678/8 "2023-06-18T19:07:07Z")

</div>

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