Jeremy Cowgar <develop@cowgar.com> writes:
> In C I would like to tell if an insert failed and why. In particular if
> it failed because of a duplicate value in a field marked unique.
Right now, the only way to tell this is to look at the error message
(PQerrorMessage), which will say something like
ERROR: Cannot insert a duplicate key into unique index foo_f1_key
This is pretty grotty, but until we get around to supporting proper
error codes, it's the only way ...
regards, tom lane