NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ?

Started by Christian Marschalekalmost 25 years ago5 messagesgeneral
Jump to latest

Can anyone tell me what this notice means?

NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s) ?

greetings

#2Joel Burton
jburton@scw.org
In reply to: Christian Marschalek (#1)
Re: NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ?

On Thu, 26 Apr 2001, Christian Marschalek wrote:

Can anyone tell me what this notice means?

NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s) ?

You probably did something like this:

CREATE TABLE child (
id REFERENCES parent ... )

and PostgreSQL handles this sort of foreign key referential
integrity by using a special kind of trigger.

This notice just lets you know this is happening.

--
Joel Burton <jburton@scw.org>
Director of Information Systems, Support Center of Washington

#3Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Christian Marschalek (#1)
Re: NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ?

On Thu, 26 Apr 2001, Christian Marschalek wrote:

Can anyone tell me what this notice means?

NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s) ?

The foreign key constraint checks are handled by triggers on the
pk and fk table. The warning just lets you know that it's creating
those triggers behind your back so to speak.

#4Gregory Wood
gregw@com-stock.com
In reply to: Christian Marschalek (#1)
Re: NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ?

Can anyone tell me what this notice means?

NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s) ?

It means that PostgreSQL will automatically create triggers to perform your
foreign key checks :)

Seriously though, PostgreSQL has to have some mechanism to check that your
foreign key values exist (or not), and it does that by using a feature
already built into PostgreSQL: triggers. Nothing you really need to worry
about unless you are doing something fancy (for instance, disabling all
triggers on either table to accomplish some action... in such a case your
foreign key relationship might be broken).

Greg

In reply to: Gregory Wood (#4)
RE: NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ?

Got it...

It seams those triggers were created to handle the types I used for the
columns: int2 and bytea...

I realy should check out the types section in the postgres docu :))

Show quoted text

-----Original Message-----
From: Gregory Wood [mailto:gregw@com-stock.com]
Sent: Thursday, April 26, 2001 7:59 PM
To: Christian Marschalek
Cc: PostgreSQL-General
Subject: Re: NOTICE: CREATE TABLE will create implicit
trigger(s) for FOREIGN KEY check(s) ?

Can anyone tell me what this notice means?

NOTICE: CREATE TABLE will create implicit trigger(s) for

FOREIGN KEY

check(s) ?

It means that PostgreSQL will automatically create triggers
to perform your foreign key checks :)

Seriously though, PostgreSQL has to have some mechanism to
check that your foreign key values exist (or not), and it
does that by using a feature already built into PostgreSQL:
triggers. Nothing you really need to worry about unless you
are doing something fancy (for instance, disabling all
triggers on either table to accomplish some action... in such
a case your foreign key relationship might be broken).

Greg