Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Please add support for INSERT RETURNING for PostgreSQL #292

SpruceCloud started this conversation in General
Discussion options

Please add support for INSERT RETURNING in PostgreSQL database.

https://www.postgresql.org/docs/9.5/sql-insert.html

It can be

  • either for returning new instance of struct filled with fields from DB
  • or adding support for last_insert_id through it (there seems to be a discussion about this field in last_insert_id is None #75)

Example:

INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')
   RETURNING did;
You must be logged in to vote

Replies: 3 comments

Comment options

I guess SQLX-core is not yet supported of INSERT RETURNING。
The current solution is to use predefined IDs, such as the snowflake algorithm and object-id. 2 is in the RBatis plugin

You must be logged in to vote
0 replies
Comment options

Please add support for INSERT RETURNING in PostgreSQL database.

https://www.postgresql.org/docs/9.5/sql-insert.html

It can be

  • either for returning new instance of struct filled with fields from DB
  • or adding support for last_insert_id through it (there seems to be a discussion about this field in last_insert_id is None #75)

Example:

INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')
   RETURNING did;

see https://github.com/rbatis/rbatis/blob/master/example/src/crud.rs

save_by_wrapper

You must be logged in to vote
0 replies
Comment options

v4 use impl_select! macro supported

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists supported
2 participants
Converted from issue

This discussion was converted from issue #96 on September 29, 2022 09:02.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.