FORIEGN KEY's, JOIN's, and others

From: Nikos Mouat <nikm(at)cyberflunk(dot)com>
To: pgsql-general(at)postgreSQL(dot)org
Subject: FORIEGN KEY's, JOIN's, and others
Date: 1999-11-24 18:01:41
Message-ID: Pine.C=64.4.21.9911240950150.25693-100000@rapture.cyberflunk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general


Hi,
I've been using Postgres for a while for pretty simple schemas.
I'm now trying to clean things up, and start enforcing data integrity at
the SQL level, rather than the application level. I'm now running into the
following:

NOTICE: CREATE TABLE/FOREIGN KEY clause ignored; not yet implemented
ERROR: JOIN expressions are not yet implemented

Is there a time frame for the addition of these features?
I frequently use OID's to reference entries in other tables, for instance:

CREATE TABLE speeds (
speed varchar
);

CREATE TABLE plans (
name varchar,
def_speed oid,
def_price money
);

now plans.def_speed is simply the oid in speeds. How can I make sure that
when an INSERT is done into plans, the value in def_speed is really an oid
in speeds? How can I stop users from deleting an entry in speeds when that
OID is used in plans.def_speed?

Is there some way to do this that I don't know about? (which I assume to
be likely) - Is REFERENCES or FOREIGN KEY the answer that I'm looking for?

Also, is there a way to create sub tables, ie, something like:

CREATE TABLE cust_notes (
note_date date,
added_by oid,
note varchar
);

CREATE TABLE customers (
customer_name varchar,
notes table cust_notes
);

and then allow me to somehow do:

select note_date,added_by,note from customers.notes where customers.oid =
12345;

I currently do this by doing:

CREATE TABLE cust_notes (
note_date date,
added_by oid,
note varchar,
customer_id oid
);

CREATE TABLE customers (
customer_name varchar,
);

select note_date,added_by,note from cust_notes where customer_id = 12345;

but it seems somehow more logical the other way.

Thanks
nm

In response to

Browse pgsql-announce by date

  From Date Subject
Next Message Manfred Knobloch 1999-11-25 09:13:34 Re: FW: [ANNOUNCE] ANNOUNCE UdmSearch
Previous Message Alexander Barkov 1999-11-24 16:59:02 ANNOUNCE UdmSearch

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Lowery 1999-11-24 18:47:33 deadlock in 6.4.2
Previous Message Santiago Martin-Pascual 1999-11-24 17:56:04 Help on PL/PGSQL