Thread

  1. FOREIGN KEY ...

    Pich LY <ly@esigetel.fr> — 1998-06-18T16:57:09Z

    Hi there,
    
    I'm a french student at ESIGETEL, a school engineer specialized in
    Networks and Telecommunications.
    
    Now, I've some trouble with my end year project. We are 4 students
    working on an local Intranet using PostgreSQL as the database manager
    (and Apache as the HTTP server).
    
    The problem is insignifiant : how can you declare an attribute as a
    foreign key ?
    The tables we are focus on are :
            CLIENT          FACTURATION
            ------          -----------
    (pkey)  no_cli  <--\    no_factu        (pkey)
            client      \-- no_cli          (foreign key)
            adr_cli         adr_livr
            ...             ...
    
    The query (in SQL language) used to declare the "FACTURATION" table is :
            CREATE TABLE Facturation
            (
                    no_factu        INTEGER PRIMARY KEY,
                    no_cli          INTEGER REFERENCES Client,
                    adr_livr        VARCHAR(50),
                    ...
            );
    
    We can also use :
            CREATE TABLE Facturation
            (
                    no_factu        INTEGER PRIMARY KEY,
                    no_cli          INTEGER,
                    adr_livr        VARCHAR(50),
                    ...
                    CONSTRAINT ct_factu REFERENCES (no_cli) FOREIGN KEY
    Client (no_cli)
            );
    
    But it doesn't seems to work ! "psql" gives us the following message :
            "NOTICE:  CREATE TABLE/FOREIGN KEY clause ignored: not yet
    implemented"
    !!!
    
    What's the right syntaxe ???
    
    Thanks for the help...
    
    ;-)
    
    
  2. Re: [SQL] FOREIGN KEY ...

    Marin D <marin@cybernet.bg> — 1998-06-19T07:56:08Z

    The message says it all...
    
    The syntax is recognized ( u've used the right one ) but foreign keys are
    not implemented in this version.
    
    U may wish to take a look at contrib/spi/refint* 
    under the Postgres source tree for implementation of referential integrity
    
    	Marin
    
              -= Why do we need gates in a world without fences? =-
    
    
    On Thu, 18 Jun 1998, Pich LY wrote:
    
    > Hi there,
    > 
    > I'm a french student at ESIGETEL, a school engineer specialized in
    > Networks and Telecommunications.
    > 
    > Now, I've some trouble with my end year project. We are 4 students
    > working on an local Intranet using PostgreSQL as the database manager
    > (and Apache as the HTTP server).
    > 
    > The problem is insignifiant : how can you declare an attribute as a
    > foreign key ?
    > The tables we are focus on are :
    >         CLIENT          FACTURATION
    >         ------          -----------
    > (pkey)  no_cli  <--\    no_factu        (pkey)
    >         client      \-- no_cli          (foreign key)
    >         adr_cli         adr_livr
    >         ...             ...
    > 
    > The query (in SQL language) used to declare the "FACTURATION" table is :
    >         CREATE TABLE Facturation
    >         (
    >                 no_factu        INTEGER PRIMARY KEY,
    >                 no_cli          INTEGER REFERENCES Client,
    >                 adr_livr        VARCHAR(50),
    >                 ...
    >         );
    > 
    > We can also use :
    >         CREATE TABLE Facturation
    >         (
    >                 no_factu        INTEGER PRIMARY KEY,
    >                 no_cli          INTEGER,
    >                 adr_livr        VARCHAR(50),
    >                 ...
    >                 CONSTRAINT ct_factu REFERENCES (no_cli) FOREIGN KEY
    > Client (no_cli)
    >         );
    > 
    > But it doesn't seems to work ! "psql" gives us the following message :
    >         "NOTICE:  CREATE TABLE/FOREIGN KEY clause ignored: not yet
    > implemented"
    > !!!
    > 
    > What's the right syntaxe ???
    > 
    > Thanks for the help...
    > 
    > ;-)
    >