Re: Whats the correct way to change trigdata->tg_relation
| От | Robert Haas |
|---|---|
| Тема | Re: Whats the correct way to change trigdata->tg_relation |
| Дата | |
| Msg-id | CA+Tgmoa6j-_fiknTUosq8vyTC6=RdW543f4ymM2jWgp=TeZBpQ@mail.gmail.com обсуждение исходный текст |
| Ответ на | Whats the correct way to change trigdata->tg_relation (Charles Gomes <charlesrg@outlook.com>) |
| Список | pgsql-hackers |
On Fri, Dec 28, 2012 at 1:06 PM, Charles Gomes <charlesrg@outlook.com> wrote: > I'm creating a simple trigger that will be called during an insert and change the destination table. > All values are going to be preserved, just the destination table will be different. > > From what I see I can't modify trigdata->tg_relation. > > All examples use: return Datum(trigdata->tg_trigtuple); // however tg_relation does not belong there. I'm trying to avoindhaving to do a SPI_EXEC; > Should I create a new heap_tuple and call heap_insert() and then Return Datum(NULL); ? Or is there another more straightforward way of doing it? Looks like if I call heap_insert I will have to update the indexes somehow. I think you need to use SPI_EXEC. Otherwise something horrible will probably happen. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: