schotime / NPoco

Simple microORM that maps the results of a query onto a POCO object. Project based on Schotime's branch of PetaPoco
Apache License 2.0
848 stars 302 forks source link

Database.InsertAsync returns 0 on insert failure without an exception. (postgress) #612

Closed vllama closed 3 years ago

vllama commented 4 years ago

Sometimes when inserts fail in postgres this function returns id of 0, but there is no exception thrown.

I would expect the Npgsql exception to be bubbled up. It seems to happen if you are missing a non null column in your poco.

var id = await Database.InsertAsync(entity);

Might be related to InsertAsync not returning the right ID #361

schotime commented 4 years ago

What version are you using?

vllama commented 4 years ago

Sorry I missed that, Latest 4.0.2

schotime commented 4 years ago

Could you try 5.0.0-rc1? otherwise provide a small sample that reproduces the issue.