# PSQL Node "Syntax Error" at UPDATE

**URL:** <https://discourse.nodered.org/t/psql-node-syntax-error-at-update/65651>\
**Category:** General\
**Tags:** database\
**Created:** [26 July 2022 18:00 UTC](https://discourse.nodered.org/t/psql-node-syntax-error-at-update/65651 "2022-07-26T18:00:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidrodord56](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/davidrodord56/32/65255_2.png) [@davidrodord56](https://discourse.nodered.org/u/davidrodord56)\
**Post date:** [26 July 2022 18:00 UTC](https://discourse.nodered.org/t/psql-node-syntax-error-at-update/65651/1 "2022-07-26T18:00:28Z")

</div>

Hi everybody, does anybody knows why I'm Getting this error in postgres node?

The error is:

> Blockquote "error: syntax error at or near "WHERE""

The node Query is:

```auto
UPDATE public.km_tracker
SET km = {{msg.payload.km}}
WHERE timestamp = {{msg.payload.timestamp}};

```

This Query below shares the same message as input.

```auto
INSERT INTO public.km_tracker (timestamp, days, km)
VALUES ({{msg.payload.timestamp}}, {{msg.payload.day}}, {{msg.payload.km}});

```

These 2 do not share the same message input

```auto
DELETE FROM public.km_tracker
WHERE timestamp = {{msg.payload}};

```

```auto
SELECT to_char(to_timestamp((timestamp/1000)+5000),'yyyy-mm-dd') as date , km 
FROM "km_tracker"
WHERE km >= 1000
ORDER BY timestamp DESC;

```

The query is working but I'm Getting the error and it prevents another part of the flow to work because of the Error Exception.  
The Create and Delete are very similar but doesn't raise and error.

I've tried changing the "{{" to different combinations but it still raises the error.

Thanks in advance

---

<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:** [24 September 2022 18:00 UTC](https://discourse.nodered.org/t/psql-node-syntax-error-at-update/65651/2 "2022-09-24T18:00:30Z")

</div>

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