Re: [GENERAL] FOREIGN KEY syntax

From: Ron Peterson <rpeterson(at)yellowbank(dot)com>
To: Andrzej Mazurkiewicz <andrzej(dot)mazurkiewicz(at)polkomtel(dot)com(dot)pl>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] FOREIGN KEY syntax
Date: 2000-03-03 14:54:44
Message-ID: 38BFD234.C1C3AD78@yellowbank.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrzej Mazurkiewicz wrote:
>
> The following information is based on gram.y file of postgres sources
>
> FOREIGN KEY ( columnList ) REFERENCES tableName [ ( columnList) ] [MATCH
> FULL] [ON DELETE action] [ON UPDATE action]
>
> [[NOT] DEFERRABLE] [INITIALLLY {IMMEDIATE | DEFERRED}] (not all matches are
> allowed)
>
> "action" is {NO ACTION | RESTRICT | CASCADE | SET NULL_P | SET DEFAULT }

What does action RESTRICT do? Disallow the update or delete?

And what is MATCH FULL?

I take it that the 'List' in 'columList' implies that a foreign key can
span multiple columns?

I did sucessfully create some tables with foreign keys using CREATE
TABLE and ALTER TABLE. That's as far as I've gotten yet, though. Maybe
when I get some various working examples I'll post them back. Here's
one example (in case anyone's interested):

CREATE TABLE contact (
contact_id SERIAL
PRIMARY KEY,
name_sort varchar(80),
name_print varchar(80),
created timestamp default current_timestamp,
FOREIGN KEY (address_id)
REFERENCES address(address_id)
ON DELETE CASCADE
);

Thanks for help.

Ron Peterson
rpeterson(at)yellowbank(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2000-03-03 15:05:57 Re: [GENERAL] Simple problem?
Previous Message M.Mazurek 2000-03-03 14:26:55 Re: [GENERAL] FOREIGN KEY syntax