# Getting errors in postgress sql

**URL:** <https://community.n8n.io/t/getting-errors-in-postgress-sql/116471>\
**Category:** Questions\
**Tags:** node, postgres\
**Created:** [May 16, 2025, 5:03pm UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471 "2025-05-16T17:03:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmad\_fahim](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ahmad_fahim/32/81584_2.png) [@ahmad\_fahim](https://community.n8n.io/u/ahmad_fahim)\
**Post date:** [May 16, 2025, 5:03pm UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/1 "2025-05-16T17:03:59Z")

</div>

```auto
INSERT INTO slack_channels (user_id, channel_id, channel_name, created_at)
VALUES ('{{$json["user_id"]}}', '{{$json["channel_id"]}}', '{{$json["channel_name"]}}', NOW())
ON CONFLICT (user_id, channel_id) 
DO UPDATE SET channel_name = EXCLUDED.channel_name, created_at = EXCLUDED.created_at;

```

error – invalid input syntax for type uuid: “{{$json[“user\_id”]}}”

n8n version: `1.91.3 (Cloud)`

Problem: I’m passing the values dynamically to the postgress node even i can see the values but when I test the flow I got the above mentioned error. I tried to hardcode the values in quotes then it is working fine. Please help me fix this issue

---

<div class="post-metadata">

**Author:** ![hjbh756r78n](https://avatars.discourse-cdn.com/v4/letter/h/71c47a/32.png) [@hjbh756r78n](https://community.n8n.io/u/hjbh756r78n)\
**Post date:** [May 16, 2025, 5:36pm UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/2 "2025-05-16T17:36:12Z")

</div>

When using **Raw query** in the SQL node in n8n, if you write the variable interpolation with quotes (like `'{{$json["user_id"]}}'`), the value is sent to PostgreSQL as a string. However, if the field expects a **UUID** type, this will cause an error because a string is not a valid UUID format.

**Don’t use quotes** : For fields expecting a UUID or other non-string types, do not wrap the interpolated value in quotes.

---

<div class="post-metadata">

**Author:** ![ahmad\_fahim](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ahmad_fahim/32/81584_2.png) [@ahmad\_fahim](https://community.n8n.io/u/ahmad_fahim)\
**Post date:** [May 16, 2025, 6:01pm UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/3 "2025-05-16T18:01:08Z")

</div>

I tried without quotes as well but no success. I think variables defined in the query parameters are not connected with the query itself. Because i can see the values inside the query parameters and when i test the node it returns uuid null. Not sure what’s going on. I’ve setup a set node before the postgress node and I’ve the set the variables as well

---

<div class="post-metadata">

**Author:** ![hjbh756r78n](https://avatars.discourse-cdn.com/v4/letter/h/71c47a/32.png) [@hjbh756r78n](https://community.n8n.io/u/hjbh756r78n)\
**Post date:** [May 16, 2025, 6:09pm UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/4 "2025-05-16T18:09:35Z")

</div>

Use direct interpolation and make sure the value comes in the correct format (such as a valid UUID) within the JSON.

---

<div class="post-metadata">

**Author:** ![ahmad\_fahim](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ahmad_fahim/32/81584_2.png) [@ahmad\_fahim](https://community.n8n.io/u/ahmad_fahim)\
**Post date:** [May 16, 2025, 6:14pm UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/5 "2025-05-16T18:14:51Z")

</div>

I’ve a separate node just before the postgress, where i have set the variables like this  
{  
“user\_id”: “{{ $node[‘Set Credentials’].json[‘user\_id’] }}”,  
“channel\_id”: “{{ $json[‘id’] }}”,  
“channel\_name”: “{{ $json[‘name’] }}”  
}

now I can see those values by clicking on query parameter and then results but still the issue persists. If you need some additional info please let me know i can provide that. Thanks

---

<div class="post-metadata">

**Author:** ![King\_Samuel\_David](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/king_samuel_david/32/83690_2.png) [@King\_Samuel\_David](https://community.n8n.io/u/King_Samuel_David)\
**Post date:** [May 16, 2025, 6:45pm UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/6 "2025-05-16T18:45:38Z")

</div>

dont u need to use `` and not ‘’ for interpolation?

---

<div class="post-metadata">

**Author:** ![ahmad\_fahim](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ahmad_fahim/32/81584_2.png) [@ahmad\_fahim](https://community.n8n.io/u/ahmad_fahim)\
**Post date:** [May 17, 2025, 6:22am UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/7 "2025-05-17T06:22:20Z")

</div>

![image](https://europe1.discourse-cdn.com/n8n/original/3X/4/8/482a494d03ebc46bdb5d709d95a8fb094aa3085c.png)  
look what i am doing wrong here i am getting the values from previous node, and it’s been visible in query parameters results as well but still user\_id is being passed null

Any suggestion pls

---

<div class="post-metadata">

**Author:** ![Erick\_Torres](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/erick_torres/32/66408_2.png) [@Erick\_Torres](https://community.n8n.io/u/Erick_Torres)\
**Post date:** [May 17, 2025, 7:08am UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/8 "2025-05-17T07:08:35Z")

</div>

If it serves as a reference, this is how I used variables that come from the JSON in the queries.

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/f/5/f5b94fe7faa27f4346cf40afa6fbdd2ab693237a.png)

with the following structure, example: ‘{{ $json.output.user\_id}}’

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [August 15, 2025, 7:08am UTC](https://community.n8n.io/t/getting-errors-in-postgress-sql/116471/9 "2025-08-15T07:08:50Z")

</div>

Closed on August 15, 2025, 7:08am UTC

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