In any extremities, Currval() returns the current session with the last value generated by the sequence. If database servers create a sequence value parallelly, then the same sequence value is present, then currval() does not update until it produces or changes its sequence value.
Currval() in PostgreSQL is used to return the last value of a sequence of the current session only which can be overcome by simply using “RETURNING id;”