Postgres Insert, or inserting a JSON array as one value

Hi - I’m trying to use the “Insert” Operation for Postgres. What should I put into the Columns and “Return Fields” inputs? I’m not seeing where to specify the data that is passed into this node.

I’m also happy to write the insert as a raw query…running into trouble trying to insert an array into one jsonb cell. Is there a way to force this into a working json? I’m running JSON.stringify but still getting an error "syntax error at or near “json” – but I don’t have “json” anywhere visible.

Thank you!

Hey @Byron,

You need to use the Set node to map the incoming values with your Postgres columns. You can then specify the column names in the Columns fields. The Return Fields allows you to return the values that you inserted. You can use the default value (*).

Below is a small example. In this example, I am inserting the name and age into an example table.

Let me know if this helps :slight_smile:

2 Likes

That works, thank you so much! I have other questions but will start a new thread.

1 Like