[fix #4408] Setting next auto increment value for postgres

+ This PR contains fix for #4408 
+ Special thanks to @alikon for suggesting fix for this issue. 

__For testing instructions, please follow #4408__