Re: libpq-fe: how to determine unique collision ?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Marc SCHAEFER <schaefer(at)alphanet(dot)ch>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: libpq-fe: how to determine unique collision ?
Date: 2001-01-04 16:10:09
Message-ID: Pine.LNX.4.30.0101041706440.1245-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://yi.org/peter-e/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc SCHAEFER 2001-01-04 16:10:55 Re: libpq-fe: how to determine unique collision ?
Previous Message Peter Eisentraut 2001-01-04 16:05:49 Re: 7.0.3 rpm testing & other problems