Improvements on style

This commit aims to improve coding style to fit our coding conventions.
Also, error message is updated wrt postgres error message guide.