Referential Integrity

Поиск
Список
Период
Сортировка
Искать

Referential Integrity

От:
coronach@datacruz.com (Mike Lemler)
Дата:
I haven't been able to find documentation on how to implement referential
integrity between tables with postgres via sql.  Could someone please post
an example.  Thanks.

Michael.

RE: Referential Integrity

От:
"Jackson, DeJuan" <djackson@cpsgroup.com>
Дата:
Take a look at:
  PGDIST/contrib/spi/refint.c
		-DEJ

> -----Original Message-----
> From:	coronach@datacruz.com [SMTP:coronach@datacruz.com]
> Sent:	Wednesday, May 13, 1998 3:29 PM
> To:	pgsql-sql@postgreSQL.org
> Subject:	Referential Integrity
> 
> I haven't been able to find documentation on how to implement
> referential
> integrity between tables with postgres via sql.  Could someone please
> post
> an example.  Thanks.
> 
> Michael.
> 

Re: Referential Integrity

От:
"Jose' Soares Da Silva" <sferac@bo.nettuno.it>
Дата:
On Wed, 13 May 1998, Mike Lemler wrote:

> I haven't been able to find documentation on how to implement referential
> integrity between tables with postgres via sql.  Could someone please post
> an example.  Thanks.
> 
> Michael.
> 
   Table Constraint definition:

      [ CONSTRAINT name ] 
        { PRIMARY KEY constraint | 
          UNIQUE constraint | 
          CHECK constraint }

   Column Constraint definition: 

      [ CONSTRAINT name ] 
        { NOT NULL constraint |
          PRIMARY KEY constraint | 
          UNIQUE constraint | 
          CHECK constraint }  

examples:

   --defines a CHECK column constraint:
   --
   CREATE TABLE distributors (
        did      DECIMAL(3) CHECK (did > 100),
        name     VARCHAR(40)
        );

   --defines a CHECK table constraint:
   --
   CREATE TABLE distributors (
        did      DECIMAL(3),
        name     VARCHAR(40)
        CONSTRAINT con1 CHECK (did > 100 AND name > '')
        );

PS: FOREIGN KEY is not implemented yet you can use TRIGGERS instead
    take a look at ...contrib/refint*
                                                     Jose'

FAQ