Updating from update trigger

Поиск
Список
Период
Сортировка
От Jonathan Mezach
Тема Updating from update trigger
Дата
Msg-id 000301c352df$e73c4fe0$0700a8c0@jonathan
обсуждение исходный текст
Ответы Re: Updating from update trigger  ("Jonathan Mezach" <jmezach@home.nl>)
Список pgsql-general
Hello,

I'm writing a program with which I can keep track of all the CD's I
have. As a backend, I'm using Postgres to store my data. Now, I have
this trigger on a table (a scheme of the database at the bottom) which
executes a function called movecdsdown. From this function, the same
table is updated. This gives no problems when the trigger is called
because of an insert, and it does what it should do. However, I also
want to update the table when that table is updated. This of course
gives me problems, cause it will begin an endless loop. So, somehow I
need to disable the trigger, or the function must now if the function
was already called, but I have no idea on how to do this.

Here is a scheme of the database I'm using:

cd            location        locationdetails    rental
renter

title (pk)        location (pk)    fk_cd (pk)
startdate (pk)    firstname (pk)
creationdate    width            fk_location (pk)
followupnr (pk)    lastname (pk)
type            height        part            fk_cd
phonenumber
fk_storedloc    parts            column        fk_firstname
email
fk_currentloc    fitshalfsize    row            fk_lastname
size            stack
enddate
            homelocation

I think the foreign and primary keys speak for themselves. The trigger
is defined on the locationdetails table. The trigger function then
updates the row field of all rows where row > NEW.row. It works
perfectly for INSERT, but it doesn't work for UPDATE.

Greetings,

Jonathan Mezach




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

Предыдущее
От: Hunter Hillegas
Дата:
Сообщение: Can't Build PGSQL on OS X With GCC 3.3
Следующее
От: Elielson Fontanezi
Дата:
Сообщение: ERROR: DefineIndex: index function must be marked iscachable