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

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

From
"Christian Marschalek"
Date:
Can anyone tell me what this notice means?

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

greetings


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


> 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


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.


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

From
"Christian Marschalek"
Date:
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 :))

> -----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
>
>