SPI-functions and transaction control

Поиск
Список
Период
Сортировка
От Mikko Partio
Тема SPI-functions and transaction control
Дата
Msg-id 2ca799770802172315s4d4caf77t3693843697982014@mail.gmail.com
обсуждение исходный текст
Ответы Re: SPI-functions and transaction control
Список pgsql-general
Hello list

I am trying to write a function in c that would 'merge' two tables together.

The idea is that we insert rows from one table to another, and if there is a constraint violation, update the old row with the new row. I have done this succesfully with plpgsql, but alas, the tables are so big that it takes quite some time for the function to finish.

Now, I was wondering if a c function would be faster, and with the help of the manual I have written a function that can insert tuples from one table to another. As the manual states (http://www.postgresql.org/docs/8.3/interactive/spi.html), there is no way to catch the constraint violation error with SPI though. The manual still mentions that there is an undocumented way of doing this, has anybody ever done this? I was looking the 'exception' code at src/pl/plpgsql/src/pl_exec.c but it's quite frightening since I really don't have that much experience in c :)

Regards

Mikko

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

Предыдущее
От: Tim Hart
Дата:
Сообщение: Re: Question about the enum type
Следующее
От: Hermann Muster
Дата:
Сообщение: Re: msvcr80.dll and PostgreSQL 8.3 under Windows XP