# INSERT an interger into PostgreSQL using postgrestor node

**URL:** <https://discourse.nodered.org/t/insert-an-interger-into-postgresql-using-postgrestor-node/39390>\
**Category:** General\
**Created:** [19 January 2021 14:19 UTC](https://discourse.nodered.org/t/insert-an-interger-into-postgresql-using-postgrestor-node/39390 "2021-01-19T14:19:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trocergian](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@Trocergian](https://discourse.nodered.org/u/Trocergian)\
**Post date:** [19 January 2021 14:19 UTC](https://discourse.nodered.org/t/insert-an-interger-into-postgresql-using-postgrestor-node/39390/1 "2021-01-19T14:19:54Z")

</div>

I can't seem to get the syntax correct for writing an integer into a PostgreSQL table using the postgrestor node getting data from a JSON string.

Here's my query for a string that works fine:

> INSERT INTO table2 (field1) VALUES ('{{msg.payload.UnitName}}');

Per the postgrestor help file it seems that for an integer I should just remove the singe quotes, but when I run this:

> INSERT INTO table2 (field2) VALUES ({{msg.payload.din1}});

I get this error:  
"error: syntax error at or near ")""

Any ideas what the correct syntax might be for working with an integer?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 January 2021 17:24 UTC](https://discourse.nodered.org/t/insert-an-interger-into-postgresql-using-postgrestor-node/39390/2 "2021-01-19T17:24:21Z")

</div>

Does `din1` actually exist in `msg.payload`? Use a debug node before& check the payload.

---

<div class="post-metadata">

**Author:** ![Trocergian](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@Trocergian](https://discourse.nodered.org/u/Trocergian)\
**Post date:** [19 January 2021 17:59 UTC](https://discourse.nodered.org/t/insert-an-interger-into-postgresql-using-postgrestor-node/39390/3 "2021-01-19T17:59:31Z")

</div>

Well... thanks for that suggestion as I found out din1 actually doesn't exist. It's DIN1.  
Sheesh, never even thought to check the case.  
Bottom line, problem fixed so I'm happy and thanks again!

---

<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:** [2 February 2021 17:59 UTC](https://discourse.nodered.org/t/insert-an-interger-into-postgresql-using-postgrestor-node/39390/4 "2021-02-02T17:59:32Z")

</div>

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