Reduce code redundancy

I make the code cleaner. So that, from now on anyone who want to contribute doesn't need to override the entire function. I make several small function and inject it to the main function.

Also, Postgresql primary key insertion has been fully resolved.

However there is still a problem with "enum" and "set" field type.