A way to get the id of inserted row as callback?
See original GitHub issueFor inserting a row, the callback just sends back this:
{
"command": "INSERT",
"rowCount": 1,
"oid": 0,
"rows": [],
"fields": [],
"_parsers": [],
"RowCtor": null,
"rowAsArray": false
}
Is there a way to get the id of the inserted row?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Get the id of the just-inserted row - Stack Overflow
The insert operation does not provide the inserted data, so there is no way to obtain it from the server on the same...
Read more >Is there a way to find ID of inserted row if there is trigger after ...
If I do something like this: new_id = db.table1.insert(...) and there is a trigger that inserts row in another table (table2) based on...
Read more >PHP MySQL Get Last Inserted ID - W3Schools
If we perform an INSERT or UPDATE on a table with an AUTO_INCREMENT field, we can get the ID of the last inserted/updated...
Read more >Python Psycopg2 - Getting ID of row just inserted
In this article, we are going to see how to get the ID of the row just inserted using pyscopg2 in Python ...
Read more >Active Record Callbacks - Ruby on Rails Guides
How to create callback methods that respond to events in the object life cycle. ... #<User id: nil> irb> User.first You have found...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

INSERT INTO foo (name) VALUES ('baz') RETURNING *Got to this the long way. Can you update the docs (specifically at https://node-postgres.com/features/queries#parameterized-query) —to use this syntax?
I’ve used RETURNING before when doing a data-modifying WITH clause, but I didn’t think to add it to a plain insert.
(also, my way of using it is with async/await…)
Suggestion: