PostgreSQL function for last inserted ID

后端 未结 11 1229

In PostgreSQL, how do I get the last id inserted into a table?

In MS SQL there is SCOPE_IDENTITY().

Please do not advise me to use something like this:

11条回答
  •  醉酒成梦
    2020-11-22 14:29

    For the ones who need to get the all data record, you can add

    returning *
    

    to the end of your query to get the all object including the id.

提交回复
热议问题