明明可以通过SELECT LASTVAL () AS insert_id很方便的获取同一个连接( session )中的最后插入的 insert id 。那为什么还要非得用select currval (regclass::seqname )来获取 id 呢?
SELECT LASTVAL () AS insert_id
select currval (regclass::seqname )