Database insert’s identity returning “INSERT”

Wappler Version: 4.2.0
Operating System: macOS Catalina (10.15.7)

Expected behavior

What do you think should happen?
I would expect to be able to use the identity value which gets returned from an INSERT call

Actual behavior

What actually happens?

When I try to use the identity of the newly added record in a follow on command I get the following message:
message: “select * from “a_demandrail” where “a_demandrail”.“id” = $1 limit $2 - invalid input syntax for type integer: “INSERT””

I’ve searched the forum and found the below entry. I’m using exactly the same configuration: nodejs & postgresql.

How to reproduce

The attached screenshot shows my failing API Action.

This happens to me as well.

Wappler 4.2.2.
Nodejs & postgres

Let me know if any logs would help.

Update: manually adding "returning": "user_id", in the json solved the problem, as described here: Nodejs: Identity returned by Insert is a nested object. It doens't return id anymore

The returning property is indeed something that is needed for postgres databases, it should normally be added automatically to the json.

I am also having the same issue in version 4.4.2
How can I bypass it?

Hi,

You need to edit the json file (right click on the server action and open in code view) and add the returning property to your query.

I did that, it however still does not return the identity

Please check out the linked topic to see an example. Nodejs: Identity returned by Insert is a nested object. It doens't return id anymore

I believe that you added it at the wrong place.

@patrick Just encountered this bug with NodeJS & Postgres.
The column in question is of type UUID in our case.
Adding the returning key-value pair manually in the JSON returns the inserted row’s identity - otherwise it returns “INSERT”.
On Wappler 5.8.2.

There are other older SAs with insert queries which have this setup running correctly - but it seems to have broken in some version after that.
We tried creating a new SA with just the insert query, and it fails.
The DB manager shows the field’s data type as UUID correctly as well.
Please help.