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

Поиск
Список
Период
Сортировка
Искать
От
Peter Eisentraut
Тема
Re: libpq-fe: how to determine unique collision ?
Дата
Msg-id
Pine.LNX.4.30.0101041706440.1245-100000@peter.localdomain
Ответ на
Список
Дерево обсуждения
libpq-fe: how to determine unique collision ? Marc SCHAEFER <schaefer@alphanet.ch>
Re: libpq-fe: how to determine unique collision ? Peter Eisentraut <peter_e@gmx.net>
Re: libpq-fe: how to determine unique collision ? Marc SCHAEFER <schaefer@alphanet.ch>
Re: libpq-fe: how to determine unique collision ? Tom Lane <tgl@sss.pgh.pa.us>
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 по дате отправления
От: Peter Eisentraut
Дата:
От: Nelio Alves Pereira Filho
Дата:
Сообщение: M$ Visio (ODBC) and Postgres
FAQ