Received: from mail.utexas.edu (wb3-a.mail.utexas.edu [128.83.126.138]) by postgresql.org (8.11.3/8.11.1) with SMTP id f72INRf95949 for ; Thu, 2 Aug 2001 14:23:27 -0400 (EDT) (envelope-from webmaster@robbyslaughter.com) Received: (qmail 27172 invoked by uid 0); 2 Aug 2001 18:17:52 -0000 Received: from adsl-64-218-163-9.dsl.austtx.swbell.net (HELO robmanbox) (64.218.163.9) by umbs-smtp-3 with SMTP; 2 Aug 2001 18:17:52 -0000 Reply-To: From: "Robby Slaughter" To: "Lorenzo De Vito" , Subject: RE: Foreign key Date: Thu, 2 Aug 2001 13:19:46 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001F_01C11B55.CCE822E0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <004601c11b6f$c945d000$58c809c0@tt> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal X-Archive-Number: 200108/17 X-Sequence-Number: 4238 This is a multi-part message in MIME format. ------=_NextPart_000_001F_01C11B55.CCE822E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Lorenzo De Vito Sent: Thursday, August 02, 2001 11:24 AM To: pgsql-sql@postgresql.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. ------=_NextPart_000_001F_01C11B55.CCE822E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Uh...I=20 think foreign keys are supported:
 
CREATE=20 TABLE main
 =20 ( id INTEGER,
    data TEXT );
 
CREATE=20 TABLE secondary
 =20 ( mainid INTEGER REFERENCES main(id),
    data TEXT );
 
That=20 will make your joins:
 
 SELECT * FROM main,secondary WHERE id =3D= =20 mainid;
 
much=20 more efficient.
 
-Robby
-----Original Message-----
From:=20 pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]= On=20 Behalf Of Lorenzo De Vito
Sent: Thursday, August 02, 2001 1= 1:24=20 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] Foreig= n=20 key

What's the best way to build a rela= tion=20 between two tables ?
I know that Foreign key is no longer=20 supported.
------=_NextPart_000_001F_01C11B55.CCE822E0--