Re: R: [postgresql-it] no cascade triggers?
От | Martijn van Oosterhout |
---|---|
Тема | Re: R: [postgresql-it] no cascade triggers? |
Дата | |
Msg-id | 20070627183134.GD22179@svana.org обсуждение исходный текст |
Ответ на | R: [postgresql-it] no cascade triggers? ("Manera, Villiam" <vmanera@manord.com>) |
Ответы |
R: R: [postgresql-it] no cascade triggers?
|
Список | pgsql-hackers |
On Wed, Jun 27, 2007 at 11:37:01AM +0200, Manera, Villiam wrote: > To better explain my problem I attach one of my functions that is easy > to understand. > > For each of my products I must have one main supplier and I may have > also some secondary suppliers. > > Therefore for each of my articles > I have as many records in table ANAMAT.ART_FOR as the number of my > suppliers for that article. > > The main supplier is identified by code 1 in the column ARF_PROGR_FORN. > Secondary suppliers are numbered as 2,3 and so on > > If, for example, I want to promote one of the secondary suppliers (let's > say number 3) > to be the main one, I should issue the following update: To be honest, it seems to me your problem is that you're trying to use triggers for something they're not designed for. What seems to be infinitly easier is to write a stored proc that you use like so: SELECT promote_supplier( article, supplier ); No trigger necessary... Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
В списке pgsql-hackers по дате отправления: