Get the last ID after INSERT the PostgreSQL database with PgBouncer
PostgreSQL creates a sequence by default per table. e.g actor_id_seq for the actor table on the column id.
So, this will return the last inserted id value:
select currval('actor_id_seq'::regclass)

The sequence generator operation is not transaction-safe. It means that if two concurrent database connections attempt to get the next value from a sequence, each client will get a different value. If one client rolls back the transaction, the sequence number of that client will be unused, creating a gap in the sequence.