Postgres node adds brackets

I am trying to insert extracted data into a postgres db but the node seems to add “{}” characters.

What am I doing wrong?

Thank you in advance for any advice!

Hey @thudak,

Welcome to the community :tada:

It is hard to see what you are sending to the node, Can you share more of the node? Can you also confirm which version you are running and how you have it deployed.

thank you! and thank you for the quick reply


Hey @thudak,

What is the output of the Item Lists node?

the output is 1 item - json data

Hey @thudak,

It kind of makes it tricky to see what the value of the URL string is there, It does look like it might be different from the zendesk URL in the first screenshot though as it isn’t an array.

Sorry so this is the input coming from the item list node
image

and this is the output of the postgres node

Interesting, What is actually being inserted into postgres and what version of n8n are you running?

I am running n8n desktop.

This is what appears in the database:
image
{https://***.zendesk.com/api/v2/tickets/2614.json}

I wonder if it is because the item is an array, what happens if you use a set node first to set the value and pass that to the Postgres node

that may be what i needed

1 Like

the method above helped but it seems like “{}” is still being sent when the input is empty. is there a way to handle this in n8n?

image

for exmaple this:
image

becomes

image

but if there is data - no brackets are added:

image

becomes:

image

in case of numbers the result is also good:

image

becomes:

image

Hey @thudak,

It is probably down to it being an array still so you would need to put in a check for an empty value maybe an if node before it to check the length of type and if it is more than 0 process the request.

Thank you for the input.

There is the possibility of several fields being empty though as this is just 1 part of a larger response.

Hey @thudak,

It is only the array fields that are likely to be an issue the others should be fine. I generally tend to check all inputs before passing it to a database anyway just so I can put a “Not Set” value if needed.

Forgive me I am newer at this.

What sort of nodes would allow me to do this?

Hey @thudak,

In theory you could do it in the set node so you would have something like the below.

Jon,

Thank you for your help with this. I ended up replacing “not set” with simply null - otherwise i was getting a lot of different errors.

1 Like