OIDs in triggers

Поиск
Список
Период
Сортировка
От Max Rudensky
Тема OIDs in triggers
Дата
Msg-id 20010217194916.302b687c.fonin@ziet.zhitomir.ua
обсуждение исходный текст
Ответы Re: OIDs in triggers  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
Hi folks,

Here's what I have:

create table contact (
    contact_id serial,
... <skipped fields>
    primary key    (contact_id)
);

create table customers (
    customer_id serial,
    shipping_contact_id int4,
    billing_contact_id int4,
... <skipped fields>

    primary key (customer_id)
);

Well, I want to write a trigger on CUSTOMERS that will insert 2 records into table CONTACT and
link it to fields shipping_contact_id and billing_contact_id in CUSTOMERS. But how, if I won't know
oids of inserted rows ? I may remember sequence's nextval in variable and use it in both insert and update
statements, but during many insert in contact table sequence's nextval may be used by
concurrent transactions, so one of them will be rolled back.

I prefer to do it with PL/pgSQL, anyway I can't use C.

Any ideas ?

Thanks,
Max Rudensky.

В списке pgsql-general по дате отправления:

Предыдущее
От: Emmanuel Charpentier
Дата:
Сообщение: Questions to lists / translations
Следующее
От: "Ian deSouza"
Дата:
Сообщение: Date types in where clause of PreparedStatement