I think this will introduce race condition errors. There can be an insert between this line and updating sequence so we will change sequence value to wrong one. I think we can achieve the same using

```
"SELECT pg_catalog.setval(" +
               "#{quoted_sequence}," +
               "(SLECT MAX(#{quoted_id}) FROM #{@model_class.quoted_table_name} where #{quoted_id} > 0) + 1" +
");"
```