Skip site navigation (1) Skip section navigation (2)

TRIGGERS

From: "Jose' Soares Da Silva" <sferac(at)bo(dot)nettuno(dot)it>
To: hackers postgres <pgsql-hackers(at)PostgreSQL(dot)org>
Cc: general postgres <pgsql-general(at)PostgreSQL(dot)org>
Subject: TRIGGERS
Date: 1998-06-04 11:10:25
Message-ID: Pine.LNX.3.96.980604104700.1087A-100000@proxy.bazzanese.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
Hi, all!

I am trying to create a trigger to update a field on a "son" table
when a linked field (foreign key) is modified on a table "father".
example:

table son:                   table father:
---------------------        ------------------------
id                   /-----< id
description         /        name
son_id  <----------/         address
...                          ...
---------------------        ------------------------

I see there's a check_foreign_key() function doing the following:

CASCADE  - to delete corresponding foreign key,
RESTRICT - to abort transaction if foreign keys exist,
SETNULL  - to set foreign key referencing primary/unique key
           being deleted to null)

I need to implement a MODIFY clause to set 'son.son_id' equal to 'father.id'
when 'father.id' is updated.

I'm not a C-programmer, then I created a SQL function, but seems that
TRIGGER doesn't recognize SQL functions.
Am I right ?
                                               Thanks, Jose'


pgsql-hackers by date

Next:From: Steve LogueDate: 1998-06-04 11:24:13
Subject: Re: [GENERAL] Re: [HACKERS] NEW POSTGRESQL LOGOS
Previous:From: Mattias KregertDate: 1998-06-04 10:48:08
Subject: Re: [HACKERS] NEW POSTGRESQL LOGOS

pgsql-general by date

Next:From: Steve LogueDate: 1998-06-04 11:24:13
Subject: Re: [GENERAL] Re: [HACKERS] NEW POSTGRESQL LOGOS
Previous:From: Daniel ŁaśDate: 1998-06-04 07:42:02
Subject: Trouble with ODBC connection

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group