[eluser]Randy Casburn[/eluser]
forget the CI DB Class...this is straight up PHP... mysql_error() will retrieve the most previous query error from the default mysql connection. If you have more the one connection open you can pass it a connection id.
[eluser]Randy Casburn[/eluser]
Maybe...and that's the key difficulty. This would be dependent on your PHP error_reporting() configuration setting at the top of your index.php file.
There is no question about the mysql_error() function.
[eluser]Randy Casburn[/eluser]
Postgres uses SQLSTATE codes. So your two choices are CI's show_error() as Colin has correctly described (make sure your error_reporting is set properly) or since you are using Postgres, you must retrieve the SQLSTATE from the DB in order to get the error status.