From that yum error, it looks like you have PHP 5.3 installed and are trying to install a PHP 5.4 package. yum erase php54
will do nothing if you have PHP 5.3 installed.
Do you want PHP 5.3 or 5.4? Depending on that, you'll need to make sure the proper packages are in your repos for the version you want, and try to install the php-pgsql package again.