RE: Foreign key

From: "Robby Slaughter" <webmaster(at)robbyslaughter(dot)com>
To: "Lorenzo De Vito" <lorenzodevito(at)email(dot)it>, <pgsql-sql(at)postgresql(dot)org>
Subject: RE: Foreign key
Date: 2001-08-02 18:19:46
Message-ID: EPEHLKLEHAHLONFOKNHNMEIJDDAA.webmaster@robbyslaughter.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Uh...I think foreign keys are supported:

CREATE TABLE main
( id INTEGER,
data TEXT );

CREATE TABLE secondary
( mainid INTEGER REFERENCES main(id),
data TEXT );

That will make your joins:

SELECT * FROM main,secondary WHERE id = mainid;

much more efficient.

-Robby
-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of Lorenzo De Vito
Sent: Thursday, August 02, 2001 11:24 AM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] Foreign key

What's the best way to build a relation between two tables ?
I know that Foreign key is no longer supported.

In response to

  • Foreign key at 2001-08-02 16:23:54 from Lorenzo De Vito

Browse pgsql-sql by date

  From Date Subject
Next Message Jason Earl 2001-08-02 19:43:01 Re: Foreign key
Previous Message Bruce Momjian 2001-08-02 16:31:08 Re: where'd the spaces come from