Re: libpq-fe: how to determine unique collision ? - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: libpq-fe: how to determine unique collision ?
Date
Msg-id Pine.LNX.4.30.0101041706440.1245-100000@peter.localdomain
Whole thread Raw
In response to libpq-fe: how to determine unique collision ?  (Marc SCHAEFER <schaefer@alphanet.ch>)
Responses Re: libpq-fe: how to determine unique collision ?
List pgsql-general
Marc SCHAEFER writes:

>    - how do you detect the error `Can't insert tuple because duplicate' ?

if (strcmp(PQerrorMessage(conn), "ERROR:  Can't insert tuple because duplicate") == 0) {
    panic();
}

I know it's not ideal, but it's about the best you can do.

>
>    - how do you get the OID of an insertion

PQoidValue()

> (the goal being to get
>      the value for the SERIAL type, in order to do something with it)  ?

Serial values and oids are not related.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: 7.0.3 rpm testing & other problems
Next
From: Nelio Alves Pereira Filho
Date:
Subject: M$ Visio (ODBC) and Postgres