data-api-client
data-api-client copied to clipboard
PostgreSQL "RETURNING" not returning values
Running the code like:
sql = `INSERT INTO unit
(unit_name, supplier, deleted, "createdAt", "updatedAt", uuid)
VALUES (:unit_name, :supplier, :deleted, :createdAt, :updatedAt, :uuid)
RETURNING id`;
const results = await rdsds.query(sql, dbUnits);
console.log('Units:', results); // Logs "Units: { updateResults: [] }"
Two lines are inserted but the return is an empty Array... Am I missing something...?
I ran a test both using the local-data-api
Docker container locally and using the Aurora Serverelss in AWS and they both return:
{
"numberOfRecordsUpdated": 0,
"records": [
[
{
"stringValue": "123"
}
]
]
}
From the INSERT with RETURNING id
the Serverless API is returning the data but seems it is lost somewhere along the line...