I'm new to Postgresql, so please bear with me.
After a call to libpq, I would like to be able to recognize specific
SQL errors which might occur, beyond the simple results obtainable
via a call to PQresultStatus(). I want more precision.
For example, I have a table with a primary key. If I attempt to insert
a new row with a duplicate key, PQresultStatus() rightly returns an
error (PGRES_FATAL_ERROR). However my program has no way to distinguish
from this blunt instrument whether it's a duplicate-key problem, or
any of hundreds of other problems.
How should my program recognize the duplicate-key error? And more
generally, how to I reconize other anticipated SQL errors?
Thanks for your help!
-- Bill